[PATCH] Introducing cg-xxdiff for conflict resolution

Subsystems: kernel build + files below scripts/ (unless maintained elsewhere), the rest

STALE3655d

9 messages, 3 authors, 2016-08-11 · open the first message on its own page

[PATCH] Introducing cg-xxdiff for conflict resolution

From: Martin Langhoff <hidden>
Date: 2016-06-15 22:42:35

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 <redacted>
---
 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

Re: [PATCH] Introducing cg-xxdiff for conflict resolution

From: Petr Baudis <hidden>
Date: 2016-06-15 22:42:41

Dear diary, on Fri, Aug 04, 2006 at 05:34:07AM CEST, I got a letter
where Martin Langhoff [off-list ref] 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 <redacted>
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*',/((..)*)$/)

Re: [PATCH] Introducing cg-xxdiff for conflict resolution

From: Martin Langhoff <hidden>
Date: 2016-06-15 22:42:41

On 9/24/06, Petr Baudis [off-list ref] 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...
quoted
+. 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...
quoted
+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

Re: [PATCH] Introducing cg-xxdiff for conflict resolution

From: Petr Baudis <hidden>
Date: 2016-06-15 22:42:41

Dear diary, on Sun, Sep 24, 2006 at 07:02:28PM CEST, I got a letter
where Martin Langhoff [off-list ref] said that...
On 9/24/06, Petr Baudis [off-list ref] wrote:
quoted
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
quoted
quoted
+. 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*',/((..)*)$/)

Re: [PATCH] Introducing cg-xxdiff for conflict resolution

From: Martin Langhoff <hidden>
Date: 2016-06-15 22:42:41

On 9/24/06, Petr Baudis [off-list ref] 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

Re: [PATCH] Introducing cg-xxdiff for conflict resolution

From: Petr Baudis <hidden>
Date: 2016-06-15 22:42:41

Dear diary, on Sun, Sep 24, 2006 at 07:22:35PM CEST, I got a letter
where Martin Langhoff [off-list ref] said that...
On 9/24/06, Petr Baudis [off-list ref] wrote:
quoted
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.
quoted
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*',/((..)*)$/)

Re: [PATCH] Introducing cg-xxdiff for conflict resolution

From: Martin Langhoff <hidden>
Date: 2016-08-11 19:20:31

On 9/25/06, Petr Baudis [off-list ref] wrote:
quoted
quoted
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,

Re: [PATCH] Introducing cg-xxdiff for conflict resolution

From: Martin Langhoff <hidden>
Date: 2016-08-11 19:47:46

On 11/3/06, Petr Baudis [off-list ref] wrote:
quoted
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,

Re: [PATCH] Introducing cg-xxdiff for conflict resolution

From: Petr Baudis <hidden>
Date: 2016-08-11 20:44:50

Dear diary, on Fri, Nov 03, 2006 at 12:40:38AM CET, I got a letter
where Martin Langhoff [off-list ref] said that...
On 9/25/06, Petr Baudis [off-list ref] wrote:
quoted
quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help