git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Introducing cg-xxdiff for conflict resolution
@ 2006-08-04  3:34 Martin Langhoff
  2006-09-24 16:50 ` Petr Baudis
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Langhoff @ 2006-08-04  3:34 UTC (permalink / raw)
  To: git; +Cc: Martin Langhoff

This is a bit of a crude but really useful shortcut for conflict resolution.
The name is bad, but matches git-xxdiff which has been around for like... ages

As Cogito doesn't make use of the index during merges/applies, cg-xxdiff
is somewhat more brittle and cannot not help during conflict resolution when
using cg-patch.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
---
 Makefile  |    3 ++-
 cg-xxdiff |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index ba9bf9a..dc21702 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,8 @@ SCRIPT=	cg-object-id cg-add cg-admin-lso
 	cg-export cg-help cg-init cg-log cg-merge cg-mkpatch cg-patch \
 	cg-fetch cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update \
 	cg cg-admin-ls cg-push cg-branch-chg cg-admin-cat cg-clean \
-	cg-admin-setuprepo cg-switch cg-mv cg-admin-rewritehist cg-tag-show
+	cg-admin-setuprepo cg-switch cg-mv cg-admin-rewritehist cg-tag-show \
+	cg-xxdiff
 
 LIB_SCRIPT=cg-Xlib cg-Xmergefile cg-Xfetchprogress cg-Xfollowrenames
 
diff --git a/cg-xxdiff b/cg-xxdiff
new file mode 100755
index 0000000..7a1a863
--- /dev/null
+++ b/cg-xxdiff
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+USAGE='<path-with-conflict>'
+SUBDIRECTORY_OK=No
+. git-sh-setup
+
+FILE=$1
+
+# Sanity checks
+if test ! -n "$FILE"
+then
+	echo Need a path
+	exit 1
+fi
+
+git cat-file blob `git rev-parse HEAD`:$FILE > $FILE~ours
+if test $? -gt 0
+then 
+	echo "Error - $FILE is not tracked by git or does not have a conflict"
+	exit 1
+fi
+echo Written $FILE~ours
+
+git cat-file blob `git rev-parse FETCH_HEAD`:$FILE > $FILE~branch
+if  test $? -gt 0
+then 
+	echo "Error - $FILE is not tracked by git or does not have a conflict"
+	exit 1
+fi
+echo Written $FILE~branch
+echo Resolved file will be saved as $FILE~merged
+
+xxdiff -wbB --show-merged-pane --merged-filename $FILE~merged $FILE~ours $FILE~branch
-- 
1.4.2.rc2.ge1f7

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Introducing cg-xxdiff for conflict resolution
  2006-08-04  3:34 [PATCH] Introducing cg-xxdiff for conflict resolution Martin Langhoff
@ 2006-09-24 16:50 ` Petr Baudis
  2006-09-24 17:02   ` Martin Langhoff
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Baudis @ 2006-09-24 16:50 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: git

Dear diary, on Fri, Aug 04, 2006 at 05:34:07AM CEST, I got a letter
where Martin Langhoff <martin@catalyst.net.nz> said that...
> This is a bit of a crude but really useful shortcut for conflict resolution.
> The name is bad, but matches git-xxdiff which has been around for like... ages

Yes, the name is horrible. :-)

> As Cogito doesn't make use of the index during merges/applies, cg-xxdiff
> is somewhat more brittle and cannot not help during conflict resolution when
> using cg-patch.
> 
> Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>

Hmm, I think this would be generally more useful during the actual merge
phase - if merge returns error, you fire up
git-magic-conflict-resolution-driver and have fun.

Which reminds me that I should make some more effort to unify
cg-Xmergeonefile and git-merge-one-file...

> +. git-sh-setup

Uh-oh. :-)

> +git cat-file blob `git rev-parse FETCH_HEAD`:$FILE > $FILE~branch

Cogito does not use FETCH_HEAD.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Introducing cg-xxdiff for conflict resolution
  2006-09-24 16:50 ` Petr Baudis
@ 2006-09-24 17:02   ` Martin Langhoff
  2006-09-24 17:12     ` Petr Baudis
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Langhoff @ 2006-09-24 17:02 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Martin Langhoff, git

On 9/24/06, Petr Baudis <pasky@suse.cz> wrote:
> Hmm, I think this would be generally more useful during the actual merge
> phase - if merge returns error, you fire up
> git-magic-conflict-resolution-driver and have fun.

Well, in many cases the conflict markers are just ok and exactly what
I want. If the two sides of the conflict are clear, the resolution is
usually clear as well. OTOH, it may be a big mess where xxdiff gives
more visual cues as to WTF is going on...

IOW I don't want it to be part of the merge automagically...

> > +. git-sh-setup
>
> Uh-oh. :-)

Is that bad? <blush> I am not doing anything too cogito-specific, and
I just don't know what cg-Xlib will do for me...

> > +git cat-file blob `git rev-parse FETCH_HEAD`:$FILE > $FILE~branch
>
> Cogito does not use FETCH_HEAD.

eeek. you ar right. I mix and match git and cogito as you can see. Not
so smart. I see cg-merge uses merging, merge-base and merging-sym --
I'll rework it using those...

cheers,



martin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Introducing cg-xxdiff for conflict resolution
  2006-09-24 17:02   ` Martin Langhoff
@ 2006-09-24 17:12     ` Petr Baudis
  2006-09-24 17:22       ` Martin Langhoff
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Baudis @ 2006-09-24 17:12 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: Martin Langhoff, git

Dear diary, on Sun, Sep 24, 2006 at 07:02:28PM CEST, I got a letter
where Martin Langhoff <martin.langhoff@gmail.com> said that...
> On 9/24/06, Petr Baudis <pasky@suse.cz> wrote:
> >Hmm, I think this would be generally more useful during the actual merge
> >phase - if merge returns error, you fire up
> >git-magic-conflict-resolution-driver and have fun.
> 
> Well, in many cases the conflict markers are just ok and exactly what
> I want. If the two sides of the conflict are clear, the resolution is
> usually clear as well. OTOH, it may be a big mess where xxdiff gives
> more visual cues as to WTF is going on...
> 
> IOW I don't want it to be part of the merge automagically...

In that case I think the most natural way for this tool to interface
would be in part of some kind of cg-resolve swiss-army knife for
resolving conflicts:

	cg-resolve --mine	for taking just the version from _my_
				side of the merge
	cg-resolve --other	dtto for the other side of the merge
	cg-resolve -g		graphically resolve
				(vimdiff/xxdiff/meld/...)
	surely more would be invented over time

> >> +. git-sh-setup
> >
> >Uh-oh. :-)
> 
> Is that bad? <blush> I am not doing anything too cogito-specific, and
> I just don't know what cg-Xlib will do for me...

Well, all the Cogito scripts should have some consistent form. :-)

But I can adjust such details when applying your patch.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Introducing cg-xxdiff for conflict resolution
  2006-09-24 17:12     ` Petr Baudis
@ 2006-09-24 17:22       ` Martin Langhoff
  2006-09-24 17:28         ` Petr Baudis
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Langhoff @ 2006-09-24 17:22 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Martin Langhoff, git

On 9/24/06, Petr Baudis <pasky@suse.cz> wrote:
> In that case I think the most natural way for this tool to interface
> would be in part of some kind of cg-resolve swiss-army knife for
> resolving conflicts:
>
>        cg-resolve --mine       for taking just the version from _my_
>                                side of the merge
>        cg-resolve --other      dtto for the other side of the merge
>        cg-resolve -g           graphically resolve
>                                (vimdiff/xxdiff/meld/...)
>        surely more would be invented over time

Sounds reasonable. But I think we have to keep in mind that you only
know if the conflict is nasty after you have a go at fixing it. And I
sometimes find that I try with cg-xxdiff... and I go back to the plain
old conflict. That is why it doesn't clobber the file -- to protect a
manual merge in process.

> Well, all the Cogito scripts should have some consistent form. :-)

heh - consistency? overrated! ;-)

> But I can adjust such details when applying your patch.

Great! -- I'm travelling and at an airport "free access" computer. It
should be illegal to run airports without free wifi in this day and
age.

cheers,


martin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Introducing cg-xxdiff for conflict resolution
  2006-09-24 17:22       ` Martin Langhoff
@ 2006-09-24 17:28         ` Petr Baudis
  2006-11-02 23:40           ` Martin Langhoff
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Baudis @ 2006-09-24 17:28 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: Martin Langhoff, git

Dear diary, on Sun, Sep 24, 2006 at 07:22:35PM CEST, I got a letter
where Martin Langhoff <martin.langhoff@gmail.com> said that...
> On 9/24/06, Petr Baudis <pasky@suse.cz> wrote:
> >In that case I think the most natural way for this tool to interface
> >would be in part of some kind of cg-resolve swiss-army knife for
> >resolving conflicts:
> >
> >       cg-resolve --mine       for taking just the version from _my_
> >                               side of the merge
> >       cg-resolve --other      dtto for the other side of the merge
> >       cg-resolve -g           graphically resolve
> >                               (vimdiff/xxdiff/meld/...)
> >       surely more would be invented over time
> 
> Sounds reasonable. But I think we have to keep in mind that you only
> know if the conflict is nasty after you have a go at fixing it. And I
> sometimes find that I try with cg-xxdiff... and I go back to the plain
> old conflict. That is why it doesn't clobber the file -- to protect a
> manual merge in process.

Oh yes, I wanted to complain about that. ;-)

Yes, sometimes it is useful to go back, but I guess most of the time
probably not (not speaking from the experience though) and I hate tools
which leave random copies of a file I have tracked in a VCS around and I
have to collect their garbage manually.

The tool should just have a way to tell it "cancel" in case of trouble
and restore the original state of the file. And of course

	cg-resolve --remerge	re-run the 3-way merge on the file

would be useful anyway.

> >But I can adjust such details when applying your patch.
> 
> Great! -- I'm travelling and at an airport "free access" computer. It
> should be illegal to run airports without free wifi in this day and
> age.

Heartily agreed.

We should always suggest the locals to build yet another airport right
near the old one to promote free market and competition!

And when one of them bankrupts it could make for a nice paintball arena,
I guess.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Introducing cg-xxdiff for conflict resolution
  2006-09-24 17:28         ` Petr Baudis
@ 2006-11-02 23:40           ` Martin Langhoff
  2006-11-03  0:11             ` Petr Baudis
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Langhoff @ 2006-11-02 23:40 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Martin Langhoff, git

On 9/25/06, Petr Baudis <pasky@suse.cz> wrote:
> > >But I can adjust such details when applying your patch.
> >
> > Great! -- I'm travelling and at an airport "free access" computer. It
> > should be illegal to run airports without free wifi in this day and
> > age.
>
> Heartily agreed.

Paski, did this one get dropped? Change of heart? Heart attack?

cheers,



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Introducing cg-xxdiff for conflict resolution
  2006-11-02 23:40           ` Martin Langhoff
@ 2006-11-03  0:11             ` Petr Baudis
  2006-11-03  2:41               ` Martin Langhoff
  0 siblings, 1 reply; 9+ messages in thread
From: Petr Baudis @ 2006-11-03  0:11 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: Martin Langhoff, git

Dear diary, on Fri, Nov 03, 2006 at 12:40:38AM CET, I got a letter
where Martin Langhoff <martin.langhoff@gmail.com> said that...
> On 9/25/06, Petr Baudis <pasky@suse.cz> wrote:
> >> >But I can adjust such details when applying your patch.
> >>
> >> Great! -- I'm travelling and at an airport "free access" computer. It
> >> should be illegal to run airports without free wifi in this day and
> >> age.
> >
> >Heartily agreed.
> 
> Paski, did this one get dropped? Change of heart? Heart attack?

Hmm, I thought we've agreed to go for the cg-resolve solution
instead...?

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Introducing cg-xxdiff for conflict resolution
  2006-11-03  0:11             ` Petr Baudis
@ 2006-11-03  2:41               ` Martin Langhoff
  0 siblings, 0 replies; 9+ messages in thread
From: Martin Langhoff @ 2006-11-03  2:41 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Martin Langhoff, git

On 11/3/06, Petr Baudis <pasky@suse.cz> wrote:
> > Paski, did this one get dropped? Change of heart? Heart attack?
>
> Hmm, I thought we've agreed to go for the cg-resolve solution
> instead...?

Oops. That wasn't my reading. Misunderstood. In any case, if you go
back a bit in the conversation, the usage model I find this useful is
one where it makes sense to try different tools that have entirely
different parameters. That is why it makes sense to call them
differently.

So cg-meld [meld params] , is different from cg-xxdiff [xxdiff params]
and cg-wiggle [wiggle params] makes more sense to me and can be
maintained by different people (those who like meld probably dont' use
xxdiff ;-)

And from a packaging perspective, cg-resolve will depend on a zillion things.

cheers,



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-11-03  2:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-04  3:34 [PATCH] Introducing cg-xxdiff for conflict resolution Martin Langhoff
2006-09-24 16:50 ` Petr Baudis
2006-09-24 17:02   ` Martin Langhoff
2006-09-24 17:12     ` Petr Baudis
2006-09-24 17:22       ` Martin Langhoff
2006-09-24 17:28         ` Petr Baudis
2006-11-02 23:40           ` Martin Langhoff
2006-11-03  0:11             ` Petr Baudis
2006-11-03  2:41               ` Martin Langhoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).