changeset 1443:6c122c975125

evolve: add a hint when the parent working copy become obsolete This should help people find the right commands to recover from this situation.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 24 Jun 2015 16:37:02 -0700
parents 6a219f8089f9
children 9a78233c62a4
files hgext/evolve.py tests/test-inhibit.t tests/test-obsolete.t tests/test-stabilize-result.t tests/test-touch.t tests/test-tutorial.t tests/test-uncommit.t
diffstat 7 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Tue Jun 23 18:16:21 2015 -0700
+++ b/hgext/evolve.py	Wed Jun 24 16:37:02 2015 -0700
@@ -685,6 +685,8 @@
     def warnobsolete():
         if repo['.'].obsolete():
             ui.warn(_('working directory parent is obsolete!\n'))
+            if (not ui.quiet) and obsolete.isenabled(repo, commandopt):
+                ui.warn(_('(use "hg evolve" to update to its successor)\n'))
     wlock = None
     try:
         wlock = repo.wlock()
--- a/tests/test-inhibit.t	Tue Jun 23 18:16:21 2015 -0700
+++ b/tests/test-inhibit.t	Wed Jun 24 16:37:02 2015 -0700
@@ -648,14 +648,21 @@
   (run 'hg heads' to see heads, 'hg merge' to merge)
 
  Only allow direct access and check that evolve works like before
+(also disable evolve commands to avoid hint about using evolve)
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > inhibit=!
+  > [experimental]
+  > evolution=createmarkers
   > EOF
 
   $ hg up 15
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete!
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > evolution=all
+  > EOF
   $ echo "CM" > cM
   $ hg amend
   $ hg log -G
--- a/tests/test-obsolete.t	Tue Jun 23 18:16:21 2015 -0700
+++ b/tests/test-obsolete.t	Wed Jun 24 16:37:02 2015 -0700
@@ -131,6 +131,7 @@
   summary:     add obsol_c
   
   working directory parent is obsolete!
+  (use "hg evolve" to update to its successor)
   $ mkcommit d # 5 (on 3)
   1 new unstable changesets
   $ qlog -r 'obsolete()'
@@ -699,6 +700,7 @@
   $ hg up --hidden 2
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   working directory parent is obsolete!
+  (use "hg evolve" to update to its successor)
   $ hg export 9468a5f5d8b2 | hg import -
   applying patch from stdin
   1 new unstable changesets
--- a/tests/test-stabilize-result.t	Tue Jun 23 18:16:21 2015 -0700
+++ b/tests/test-stabilize-result.t	Wed Jun 24 16:37:02 2015 -0700
@@ -224,6 +224,7 @@
   $ hg up --hidden 15
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete!
+  (use "hg evolve" to update to its successor)
   $ mv a a.old
   $ echo 'jungle' > a
   $ cat a.old >> a
@@ -336,6 +337,7 @@
   $ hg up --hidden 15
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete!
+  (use "hg evolve" to update to its successor)
   $ echo 'gotta break' >> a
   $ hg amend
   2 new divergent changesets
--- a/tests/test-touch.t	Tue Jun 23 18:16:21 2015 -0700
+++ b/tests/test-touch.t	Wed Jun 24 16:37:02 2015 -0700
@@ -34,6 +34,7 @@
   $ hg up --hidden 1
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   working directory parent is obsolete!
+  (use "hg evolve" to update to its successor)
   $ hg log -G
   o  3:[0-9a-f]{12} ab (re)
   
--- a/tests/test-tutorial.t	Tue Jun 23 18:16:21 2015 -0700
+++ b/tests/test-tutorial.t	Wed Jun 24 16:37:02 2015 -0700
@@ -742,12 +742,14 @@
   searching for changes
   no changes found
   working directory parent is obsolete!
+  (use "hg evolve" to update to its successor)
 
 now let's see where we are, and update to the successor
 
   $ hg parents
   bf1b0d202029 (draft): animals
   working directory parent is obsolete!
+  (use "hg evolve" to update to its successor)
   $ hg evolve
   update:[8] animals
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-uncommit.t	Tue Jun 23 18:16:21 2015 -0700
+++ b/tests/test-uncommit.t	Wed Jun 24 16:37:02 2015 -0700
@@ -240,6 +240,7 @@
   8 files updated, 0 files merged, 1 files removed, 0 files unresolved
   (leaving bookmark touncommit-bm)
   working directory parent is obsolete!
+  (use "hg evolve" to update to its successor)
   $ hg --config extensions.purge= purge
   $ hg uncommit -I 'set:added() and e'
   2 new divergent changesets
@@ -284,6 +285,7 @@
   $ hg up -C 3 --hidden
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory parent is obsolete!
+  (use "hg evolve" to update to its successor)
   $ hg --config extensions.purge= purge
   $ hg uncommit --all -X e
   1 new divergent changesets