Patchwork [5,of,5] rebase: specify custom conflict marker labels for rebase

login
register
mail settings
Submitter Durham Goode
Date May 9, 2014, 12:33 a.m.
Message ID <375164d1425477d42f9d.1399595610@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/4688/
State Changes Requested
Headers show

Comments

Durham Goode - May 9, 2014, 12:33 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1399593356 25200
#      Thu May 08 16:55:56 2014 -0700
# Node ID 375164d1425477d42f9d5c032465d79727648b17
# Parent  75ff3fc095cae6dcf513d424b7abb23121cc7e55
rebase: specify custom conflict marker labels for rebase

Changes rebase conflict markers to say 'source' and 'destination' instead of
'local' and 'other'.  This ends up looking like:

  one
  <<<<<<< destination: a3e5  master - "A commit to master"
  master
  =======
  mine
  >>>>>>> source: c7fd  - "A commit to my feature branch"
  three
Pierre-Yves David - May 9, 2014, 5:14 a.m.
On 05/08/2014 05:33 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1399593356 25200
> #      Thu May 08 16:55:56 2014 -0700
> # Node ID 375164d1425477d42f9d5c032465d79727648b17
> # Parent  75ff3fc095cae6dcf513d424b7abb23121cc7e55
> rebase: specify custom conflict marker labels for rebase
>
> Changes rebase conflict markers to say 'source' and 'destination' instead of
> 'local' and 'other'.  This ends up looking like:
>
>    one
>    <<<<<<< destination: a3e5  master - "A commit to master"
>    master
>    =======
>    mine
>    >>>>>>> source: c7fd  - "A commit to my feature branch"
>    three

Destination is a bit long and waste a significant amount of space. We 
could maybe shorten it to `dest:`

Also I feel like using label of the same length would make the markers 
more readable.
Mads Kiilerich - May 9, 2014, 10:42 a.m.
On 05/09/2014 02:33 AM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1399593356 25200
> #      Thu May 08 16:55:56 2014 -0700
> # Node ID 375164d1425477d42f9d5c032465d79727648b17
> # Parent  75ff3fc095cae6dcf513d424b7abb23121cc7e55
> rebase: specify custom conflict marker labels for rebase
>
> Changes rebase conflict markers to say 'source' and 'destination' instead of
> 'local' and 'other'.  This ends up looking like:
>
>    one
>    <<<<<<< destination: a3e5  master - "A commit to master"
>    master
>    =======
>    mine
>    >>>>>>> source: c7fd  - "A commit to my feature branch"
>    three

The revisions to rebase can be specified as source, base or revisions. 
Calling it source in all cases could perhaps be a bit confusing. 
Alternatives could be "original" or "rebasing" ... but source is 
probably better...

Whatever we call it, it would also be nice if it was consistent with 
what it is called in graft.

Besides that and Marmoutes comments: looks good to me!

/Mads
Durham Goode - May 9, 2014, 6:55 p.m.
On 5/9/14, 3:42 AM, "Mads Kiilerich" <mads@kiilerich.com> wrote:

>On 05/09/2014 02:33 AM, Durham Goode wrote:
>> # HG changeset patch
>> # User Durham Goode <durham@fb.com>
>> # Date 1399593356 25200
>> #      Thu May 08 16:55:56 2014 -0700
>> # Node ID 375164d1425477d42f9d5c032465d79727648b17
>> # Parent  75ff3fc095cae6dcf513d424b7abb23121cc7e55
>> rebase: specify custom conflict marker labels for rebase
>>
>> Changes rebase conflict markers to say 'source' and 'destination'
>>instead of
>> 'local' and 'other'.  This ends up looking like:
>>
>>    one
>>    <<<<<<< destination: a3e5  master - "A commit to master"
>>    master
>>    =======
>>    mine
>>    >>>>>>> source: c7fd  - "A commit to my feature branch"
>>    three
>
>The revisions to rebase can be specified as source, base or revisions.
>Calling it source in all cases could perhaps be a bit confusing.
>Alternatives could be "original" or "rebasing" ... but source is
>probably better...

Base and revisions make very little sense, even within the context of the
rebase command (I explain -b to our new employees as Œdash bookmark¹
because base is meaningless).  ³source² and ³destination² make sense in
all cases.  I¹ll try to figure out a shorter version of Œdestination¹ like
pierre-yves suggested.

>
>Whatever we call it, it would also be nice if it was consistent with
>what it is called in graft.

Will look into this.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -533,7 +533,8 @@ 
         repo.ui.debug("   detach base %d:%s\n" % (repo[base].rev(), repo[base]))
     # When collapsing in-place, the parent is the common ancestor, we
     # have to allow merging with it.
-    return merge.update(repo, rev, True, True, False, base, collapse)
+    return merge.update(repo, rev, True, True, False, base, collapse,
+        labels=['destination', 'source'])
 
 def nearestrebased(repo, rev, state):
     """return the nearest ancestors of rev in the rebase result"""
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -210,11 +210,11 @@ 
   +++ b/a/a
   @@ -1,2 +1,6 @@
    a
-  +<<<<<<< local: *  - "pending changes temporary commit" (glob)
+  +<<<<<<< destination: *  - "pending changes temporary commit" (glob)
    c
   +=======
   +a
-  +>>>>>>> other: *  - "changes to '[mq]: second.patch'" (glob)
+  +>>>>>>> source: *  - "changes to '[mq]: second.patch'" (glob)
   diff --git a/b.rename/b b/b.rename/b
   new file mode 100644
   --- /dev/null
@@ -601,11 +601,11 @@ 
   M f
   ? f.orig
   $ cat f
-  <<<<<<< local: 5f6b  - "pending changes temporary commit"
+  <<<<<<< destination: 5f6b  - "pending changes temporary commit"
   g
   =======
   f
-  >>>>>>> other: 23b2  - "changes to 'commit stuff'"
+  >>>>>>> source: 23b2  - "changes to 'commit stuff'"
   $ cat f.orig
   g
   $ hg unshelve --abort
@@ -644,11 +644,11 @@ 
   M f
   ? f.orig
   $ cat f
-  <<<<<<< local: 6b56  - "intermediate other change"
+  <<<<<<< destination: 6b56  - "intermediate other change"
   g
   =======
   f
-  >>>>>>> other: 23b2  - "changes to 'commit stuff'"
+  >>>>>>> source: 23b2  - "changes to 'commit stuff'"
   $ cat f.orig
   g
   $ hg unshelve --abort