branching: merge with stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 03 Sep 2019 12:48:47 +0200
changeset 4827 4c6dd20e8cc2
parent 4821 d8e36e60aea0 (current diff)
parent 4825 9af212b8565a (diff)
child 4833 72cebe6642d7
branching: merge with stable
CHANGELOG
hgext3rd/evolve/evolvecmd.py
hgext3rd/evolve/obshistory.py
--- a/CHANGELOG	Thu Jul 25 18:37:16 2019 +0800
+++ b/CHANGELOG	Tue Sep 03 12:48:47 2019 +0200
@@ -11,6 +11,11 @@
   * abort: add support for `evolve` and `pick` to `hg abort` (hg-5.1+)
   * rewind: add --keep flag to preserve working copy
 
+9.1.1 - in progress
+-------------------
+
+  * obslog: correct spacing of patch output with word-diff=yes (issue6175)
+
 9.1.0 -- 2019-07-29
 -------------------
 
--- a/hgext3rd/evolve/evolvecmd.py	Thu Jul 25 18:37:16 2019 +0800
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Sep 03 12:48:47 2019 +0200
@@ -124,8 +124,8 @@
         return (False, b".")
     obs = pctx
     newer = obsutil.successorssets(repo, obs.node())
-    # search of a parent which is not killed
-    while not newer or newer == [()]:
+    # search of a parent which is not killed, but also isn't the orig
+    while not newer or newer == [()] or newer[0][0] == orig.node():
         ui.debug(b"stabilize target %s is plain dead,"
                  b" trying to stabilize on its parent\n" %
                  obs)
--- a/hgext3rd/evolve/obshistory.py	Thu Jul 25 18:37:16 2019 +0800
+++ b/hgext3rd/evolve/obshistory.py	Tue Sep 03 12:48:47 2019 +0200
@@ -604,13 +604,17 @@
             diffopts = patch.diffallopts(repo.ui, {})
             matchfn = scmutil.matchall(repo)
             firstline = True
+            linestart = True
             for chunk, label in patch.diffui(repo, node, succ, matchfn,
                                              opts=diffopts):
                 if firstline:
                     fm.plain(b'\n')
                     firstline = False
-                if chunk and chunk != b'\n':
+                if linestart:
                     fm.plain(b'    ')
+                    linestart = False
+                if chunk == b'\n':
+                    linestart = True
                 fm.write(b'patch', b'%s', chunk, label=label)
         else:
             nopatch = b"    (No patch available, %s)" % _patchavailable[1]
@@ -740,13 +744,17 @@
             diffopts = patch.diffallopts(repo.ui, {})
             matchfn = scmutil.matchall(repo)
             firstline = True
+            linestart = True
             for chunk, label in patch.diffui(repo, node, succ, matchfn,
                                              opts=diffopts):
                 if firstline:
                     fm.plain(b'\n')
                     firstline = False
-                if chunk and chunk != b'\n':
+                if linestart:
                     fm.plain(b'    ')
+                    linestart = False
+                if chunk == b'\n':
+                    linestart = True
                 fm.write(b'patch', b'%s', chunk, label=label)
         else:
             nopatch = b"    (No patch available, %s)" % _patchavailable[1]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-issue6097.t	Tue Sep 03 12:48:47 2019 +0200
@@ -0,0 +1,99 @@
+Orphan changeset and trying to relocate a node on top of itself (issue6097)
+https://bz.mercurial-scm.org/show_bug.cgi?id=6097
+
+  $ . $TESTDIR/testlib/common.sh
+
+  $ cat << EOF >> $HGRCPATH
+  > [extensions]
+  > rebase =
+  > evolve =
+  > EOF
+
+  $ hg init issue6097
+  $ cd issue6097
+
+  $ echo apricot > a
+  $ hg ci -qAm apricot
+
+  $ echo banana > b
+  $ hg ci -qAm banana
+
+Let's go back to amend 0 and make an orphan out of 1
+
+  $ hg up -q 0
+  $ echo coconut > c
+  $ hg add -q c
+  $ hg ci --amend -m 'apricot and coconut'
+  1 new orphan changesets
+
+Now rebase the successor of 0 on top of 1
+
+  $ hg rebase -r . -d 1
+  rebasing 2:32acf8fb1b23 "apricot and coconut" (tip)
+  1 new orphan changesets
+
+Pruning 1 just to get it out of the way
+
+  $ hg prune -q 1
+
+Note how both the regular DAG and the obsolescence graph are linear, but the
+paths from 3 to 0 are different: 3-1-0 and 3-2-0
+
+  $ hg log -G
+  @  changeset:   3:2868fe6df617
+  |  tag:         tip
+  |  parent:      1:e0486f65907d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: orphan
+  |  summary:     apricot and coconut
+  |
+  x  changeset:   1:e0486f65907d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  obsolete:    pruned using prune
+  |  summary:     banana
+  |
+  x  changeset:   0:692cc7b6212c
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     obsolete:    rewritten using amend, rebase as 3:2868fe6df617
+     summary:     apricot
+  
+
+  $ hg obslog
+  @  2868fe6df617 (3) apricot and coconut
+  |
+  x  32acf8fb1b23 (2) apricot and coconut
+  |    rewritten(parent, content) as 2868fe6df617 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  692cc7b6212c (0) apricot
+       rewritten(description, content) as 32acf8fb1b23 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+
+  $ hg evolve -r .
+  move:[3] apricot and coconut
+  atop:[-1] 
+  working directory is now at bb847d1d3a5f
+
+  $ hg log -G
+  @  changeset:   4:bb847d1d3a5f
+     tag:         tip
+     parent:      -1:000000000000
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     apricot and coconut
+  
+
+  $ hg obslog
+  @  bb847d1d3a5f (4) apricot and coconut
+  |
+  x  2868fe6df617 (3) apricot and coconut
+  |    rewritten(parent) as bb847d1d3a5f using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  32acf8fb1b23 (2) apricot and coconut
+  |    rewritten(parent, content) as 2868fe6df617 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  692cc7b6212c (0) apricot
+       rewritten(description, content) as 32acf8fb1b23 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  
--- a/tests/test-evolve-obshistory-amend.t	Thu Jul 25 18:37:16 2019 +0800
+++ b/tests/test-evolve-obshistory-amend.t	Tue Sep 03 12:48:47 2019 +0200
@@ -109,7 +109,7 @@
       @@ -1,1 +1,2 @@
        A0
       +42
-  
+      
 
   $ hg obslog 4ae3a4151de9 --graph -T'{label("log.summary", shortdescription)} {if(markers, join(markers % "at {date|hgdate} by {user|person} ", " also "))}'
   @  A1
--- a/tests/test-evolve-phase-divergence.t	Thu Jul 25 18:37:16 2019 +0800
+++ b/tests/test-evolve-phase-divergence.t	Tue Sep 03 12:48:47 2019 +0200
@@ -1412,6 +1412,10 @@
 
   $ hg init cancelled-changes
   $ cd cancelled-changes
+  $ cat << EOF > .hg/hgrc
+  > [diff]
+  > word-diff = yes
+  > EOF
   $ cat << EOF > numbers
   > 1
   > 2