changeset 3794:b89108d3eca0

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 05 Jun 2018 03:37:15 +0200
parents 3343c5491b31 (diff) bb7d1616407f (current diff)
children b8b4ff86feb8
files CHANGELOG hgext3rd/evolve/evolvecmd.py tests/test-evolve-abort-orphan.t tests/test-evolve-abort.t
diffstat 5 files changed, 156 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Thu May 24 02:12:14 2018 +0530
+++ b/CHANGELOG	Tue Jun 05 03:37:15 2018 +0200
@@ -6,6 +6,12 @@
 
   * evolve: handle branch changes when solving content divergence,
 
+8.0.1 -- in-progress
+---------------------
+
+  * next-prev: respect commands.update.check config option (issue5808)
+  * next-prev: fix `evolve --abort` on conflicts (issue5897)
+
 8.0.0 -- 2018-04-25
 -------------------
 
--- a/hgext3rd/evolve/__init__.py	Thu May 24 02:12:14 2018 +0530
+++ b/hgext3rd/evolve/__init__.py	Tue Jun 05 03:37:15 2018 +0200
@@ -973,7 +973,12 @@
             repo.ui.write(_('hg bookmark %s -r %s;\n')
                           % (bookmark, target))
     else:
-        ret = hg.update(repo, target.rev())
+        try:
+            ret = hg.updatetotally(repo.ui, repo, target.node(), None)
+        except error.Abort as exc:
+            # replace the hint to mention about --merge option
+            exc.hint = _('do you want --merge?')
+            raise
         if not ret:
             tr = lock = None
             try:
@@ -1050,11 +1055,15 @@
         if len(wparents) != 1:
             raise error.Abort(_('merge in progress'))
         if not opts['merge']:
-            try:
-                cmdutil.bailifchanged(repo)
-            except error.Abort as exc:
-                exc.hint = _('do you want --merge?')
-                raise
+            # we only skip the check if noconflict is set
+            if ui.config('commands', 'update.check') == 'noconflict':
+                pass
+            else:
+                try:
+                    cmdutil.bailifchanged(repo)
+                except error.Abort as exc:
+                    exc.hint = _('do you want --merge?')
+                    raise
 
         displayer = compat.changesetdisplayer(ui, repo,
                                               {'template': shorttemplate})
@@ -1103,12 +1112,21 @@
         wparents = wkctx.parents()
         if len(wparents) != 1:
             raise error.Abort(_('merge in progress'))
+
+        # check for dirty wdir if --evolve is passed
+        if opts['evolve']:
+            cmdutil.bailifchanged(repo)
+
         if not opts['merge']:
-            try:
-                cmdutil.bailifchanged(repo)
-            except error.Abort as exc:
-                exc.hint = _('do you want --merge?')
-                raise
+            # we only skip the check if noconflict is set
+            if ui.config('commands', 'update.check') == 'noconflict':
+                pass
+            else:
+                try:
+                    cmdutil.bailifchanged(repo)
+                except error.Abort as exc:
+                    exc.hint = _('do you want --merge?')
+                    raise
 
         children = [ctx for ctx in wparents[0].children() if not ctx.obsolete()]
         topic = _getcurrenttopic(repo)
@@ -1195,7 +1213,13 @@
         if shouldmove:
             ui.write(_('hg bookmark %s -r %s;\n') % (bm, children))
     else:
-        ret = hg.update(repo, children)
+        try:
+            ret = hg.updatetotally(ui, repo, children.node(), None)
+        except error.Abort as exc:
+            # replace the hint to mention about --merge option
+            exc.hint = _('do you want --merge?')
+            raise
+
         if not ret:
             lock = tr = None
             try:
--- a/hgext3rd/evolve/evolvecmd.py	Thu May 24 02:12:14 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Jun 05 03:37:15 2018 +0200
@@ -1295,6 +1295,14 @@
         if not evolvestate:
             raise error.Abort(_('no interrupted evolve to stop'))
         evolvestate.load()
+        # `hg next --evolve` in play
+        if evolvestate['command'] != 'evolve':
+            pctx = repo['.']
+            hg.updaterepo(repo, pctx.node(), True)
+            ui.status(_('evolve aborted\n'))
+            ui.status(_('working directory is now at %s\n')
+                      % pctx.hex()[:12])
+            return 0
         return abortevolve(ui, repo, evolvestate)
     else:
         cmdutil.bailifchanged(repo)
--- a/tests/test-evolve-abort-orphan.t	Thu May 24 02:12:14 2018 +0530
+++ b/tests/test-evolve-abort-orphan.t	Tue Jun 05 03:37:15 2018 +0200
@@ -502,3 +502,24 @@
   |/    () draft
   o  0:8fa14d15e168 added hgignore
       () draft
+
+Testing `--abort` when conflicts are caused due to `hg next --evolve`
+=====================================================================
+
+  $ hg next --evolve
+  move:[2] added b
+  atop:[4] added a
+  working directory now at c1f4718020e3
+  $ hg next --evolve
+  move:[3] added c
+  atop:[5] added b
+  merging c
+  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
+  evolve failed!
+  fix conflict and run 'hg evolve --continue' or use 'hg evolve --abort' to abort
+  abort: unresolved merge conflicts (see hg help resolve)
+  [255]
+
+  $ hg evolve --abort
+  evolve aborted
+  working directory is now at c1f4718020e3
--- a/tests/test-prev-next.t	Thu May 24 02:12:14 2018 +0530
+++ b/tests/test-prev-next.t	Tue Jun 05 03:37:15 2018 +0200
@@ -354,3 +354,88 @@
   atop:[3] one
   working directory now at a7d885c75614
   $ wait
+
+testing next --evolve when working directory is dirty
+
+  $ hg log -GT "{rev}:{node|short} {desc|firstline}"
+  @  4:a7d885c75614 two
+  |
+  o  3:c741983992fc one
+  
+
+  $ hg up .^
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ echo foobar > bar
+  $ hg add bar
+  $ hg amend
+  1 new orphan changesets
+
+  $ echo babar > bar
+
+  $ hg next --evolve
+  abort: uncommitted changes
+  [255]
+
+  $ cd ..
+
+Testing that `next` and `prev` respects `commands.update.check=noconflict`
+
+  $ hg init noconflict
+  $ cd noconflict
+  $ echo "[commands]" >> .hg/hgrc
+  $ echo "update.check=noconflict" >> .hg/hgrc
+
+  $ echo hi > wat
+  $ hg ci -Aqm "added wat"
+  $ echo hi > foo
+  $ hg ci -Aqm "added foo"
+  $ echo hi > bar
+  $ hg ci -Aqm "added bar"
+
+testing for `hg prev`
+
+  $ echo bar > wat
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [1] added foo
+  $ hg diff
+  diff -r cf959ce4e1ff wat
+  --- a/wat	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/wat	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -hi
+  +bar
+
+testing for `hg next`
+
+  $ hg next
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [2] added bar
+  $ hg diff
+  diff -r ac3de1218820 wat
+  --- a/wat	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/wat	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -hi
+  +bar
+
+test that we dont end up in merge conflicts
+
+  $ echo bar > bar
+  $ hg prev
+  abort: conflicting changes
+  (do you want --merge?)
+  [255]
+
+  $ echo hi > bar
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [1] added foo
+  $ echo bar > bar
+  $ hg add bar
+
+  $ hg next
+  abort: conflicting changes
+  (do you want --merge?)
+  [255]