branching: merge with stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 05 Jan 2018 23:20:30 +0100
changeset 3375 1cb549cd6236
parent 3374 612b3bd31499 (current diff)
parent 3363 380fa6e8baf2 (diff)
child 3376 aad37ffd7d58
branching: merge with stable
CHANGELOG
hgext3rd/evolve/__init__.py
tests/test-evolve-obshistory.t
tests/test-evolve-topic.t
tests/test-tutorial.t
--- a/CHANGELOG	Fri Jan 05 17:15:43 2018 +0530
+++ b/CHANGELOG	Fri Jan 05 23:20:30 2018 +0100
@@ -20,6 +20,9 @@
 7.1.1 - in progress
 -------------------
 
+  * fix `hg prev` behavior on obsolete changesets
+  * no longer issue "obsolete working copy" message during no-op
+
 topic (0.6.1)
 
   * fix compatibility with Mercurial-4.3
--- a/hgext3rd/evolve/__init__.py	Fri Jan 05 17:15:43 2018 +0530
+++ b/hgext3rd/evolve/__init__.py	Fri Jan 05 23:20:30 2018 +0100
@@ -696,12 +696,14 @@
 
 # This section take care of issue warning to the user when troubles appear
 
-def _warnobsoletewc(ui, repo):
+def _warnobsoletewc(ui, repo, prevnode=None, wasobs=None):
     rev = repo['.']
 
     if not rev.obsolete():
         return
 
+    if rev.node() == prevnode and wasobs:
+        return
     msg = _("working directory parent is obsolete! (%s)\n")
     shortnode = node.short(rev.node())
 
@@ -775,8 +777,12 @@
 @eh.wrapcommand("pull")
 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts):
     """Warn that the working directory parent is an obsolete changeset"""
+    ctx = repo['.']
+    node = ctx.node()
+    isobs = ctx.obsolete()
+
     def warnobsolete():
-        _warnobsoletewc(ui, repo)
+        _warnobsoletewc(ui, repo, node, isobs)
     wlock = None
     try:
         wlock = repo.wlock()
@@ -2052,6 +2058,8 @@
 
     # we do not filter in the 1 case to allow prev to t0
     if currenttopic and topic and _gettopicidx(p1) != 1:
+        parents = [repo[_singlesuccessor(repo, ctx)] if ctx.mutable() else ctx
+                   for ctx in parents]
         parents = [ctx for ctx in parents if ctx.topic() == currenttopic]
 
     # issue message for the various case
--- a/tests/test-evolve-obshistory.t	Fri Jan 05 17:15:43 2018 +0530
+++ b/tests/test-evolve-obshistory.t	Fri Jan 05 23:20:30 2018 +0100
@@ -977,8 +977,6 @@
   working directory parent is obsolete! (471f378eab4c)
   (use 'hg evolve' to update to its successor: eb5a0daa2192)
   $ hg update 0dec01379d3b
-  working directory parent is obsolete! (471f378eab4c)
-  (use 'hg evolve' to update to its successor: eb5a0daa2192)
   abort: hidden revision '0dec01379d3b'!
   (use --hidden to access hidden revisions; successor: eb5a0daa2192)
   [255]
@@ -1534,12 +1532,8 @@
   (use 'hg evolve' to update to its successor: eb5a0daa2192)
   $ hg update 0dec01379d3b
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (0dec01379d3b)
-  (use 'hg evolve' to update to its successor: eb5a0daa2192)
   $ hg update --hidden 'desc(B0)'
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  working directory parent is obsolete! (0dec01379d3b)
-  (use 'hg evolve' to update to its successor: eb5a0daa2192)
 
 Test output with pushed and pulled obs markers
 ==============================================
--- a/tests/test-evolve-topic.t	Fri Jan 05 17:15:43 2018 +0530
+++ b/tests/test-evolve-topic.t	Fri Jan 05 23:20:30 2018 +0100
@@ -224,3 +224,46 @@
   switching to topic foo
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   [12] add eee
+
+Testing when instability is involved
+
+  $ hg log -G
+  o  17 - {bar} 9bf430c106b7 add jjj (draft)
+  |
+  o  16 - {bar} d2dc89c57700 add iii (draft)
+  |
+  o  15 - {bar} 20bc4d02aa62 add hhh (draft)
+  |
+  o  14 - {bar} 16d6f664b17c add ggg (draft)
+  |
+  o  13 - {foo} 070c5573d8f9 add fff (draft)
+  |
+  @  12 - {foo} 42b49017ff90 add eee (draft)
+  |
+  o  10 - {foo} d9cacd156ffc add ddd (draft)
+  |
+  o  2 - {foo} cced9bac76e3 add ccc (draft)
+  |
+  o  1 - {} a4dbed0837ea add bbb (draft)
+  |
+  o  0 - {} 199cc73e9a0b add aaa (draft)
+  
+  $ hg topic -r 13 bar
+  changed topic on 1 changes
+  $ hg up 14
+  switching to topic bar
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg stack
+  ### topic: bar
+  ### target: default (branch)
+  t5$ add jjj (unstable)
+  t4$ add iii (unstable)
+  t3$ add hhh (unstable)
+  t2$ add ggg (current unstable)
+  t1: add fff
+  t0^ add eee (base)
+
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [18] add fff
--- a/tests/test-tutorial.t	Fri Jan 05 17:15:43 2018 +0530
+++ b/tests/test-tutorial.t	Fri Jan 05 23:20:30 2018 +0100
@@ -1515,8 +1515,6 @@
   pulling from $TESTTMP/local (glob)
   searching for changes
   no changes found
-  working directory parent is obsolete! (bf1b0d202029)
-  (use 'hg evolve' to update to its successor: ee942144f952)
 
 Now let's see where we are, and update to the successor.