changeset 900:98b5ac44a259

merge stable into default
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sun, 13 Apr 2014 16:46:13 -0400
parents 4c305b8d4259 (current diff) 12ed6dfa8eea (diff)
children 33fdaec24432
files hgext/evolve.py tests/test-tutorial.t
diffstat 3 files changed, 102 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Mon Apr 07 16:41:29 2014 -0700
+++ b/hgext/evolve.py	Sun Apr 13 16:46:13 2014 -0400
@@ -20,6 +20,7 @@
 '''
 
 testedwith = 'default'
+
 buglink = 'https://bitbucket.org/marmoute/mutable-history/issues'
 
 import sys
@@ -1073,7 +1074,7 @@
         ui.write('        mean length:        %9i\n' % mean)
 
 @command('^evolve|stabilize|solve',
-    [('n', 'dry-run', False, 'do not perform actions, print what to be done'),
+    [('n', 'dry-run', False, 'do not perform actions, just print what would be done'),
     ('A', 'any', False, 'evolve any troubled changeset'),
     ('a', 'all', False, 'evolve all troubled changesets'),
     ('c', 'continue', False, 'continue an interrupted evolution'), ],
@@ -1081,13 +1082,13 @@
 def evolve(ui, repo, **opts):
     """Solve trouble in your repository
 
-    - rebase unstable changeset to make it stable again,
-    - create proper diff from bumped changeset,
-    - merge divergent changesets.
+    - rebase unstable changesets to make them stable again,
+    - create proper diffs from bumped changesets,
+    - merge divergent changesets,
     - update to a successor if the working directory parent is
       obsolete
 
-    By default, take the first trouble changeset that looks relevant.
+    By default, takes the first troubled changeset that looks relevant.
 
     (The logic is still a bit fuzzy)
 
@@ -1097,7 +1098,7 @@
 
     - For divergent, this means taking "." if applicable.
 
-    With --any, evolve picks any troubled changeset to solve.
+    With --any, evolve picks any troubled changeset to repair.
 
     The working directory is updated to the newly created revision.
     """
@@ -1536,7 +1537,12 @@
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
     if len(parents) == 1:
         p = parents[0]
-        hg.update(repo, p.rev())
+        bm = bookmarks.readcurrent(repo)
+        shouldmove = bm is not None and bookmarks.iscurrent(repo, bm)
+        ret = hg.update(repo, p.rev())
+        if not ret and shouldmove:
+            repo._bookmarks[bm] = p.node()
+            repo._bookmarks.write()
         displayer.show(p)
         return 0
     else:
@@ -1562,7 +1568,12 @@
         return 1
     if len(children) == 1:
         c = children[0]
-        hg.update(repo, c.rev())
+        bm = bookmarks.readcurrent(repo)
+        shouldmove = bm is not None and bookmarks.iscurrent(repo, bm)
+        ret = hg.update(repo, c.rev())
+        if not ret and shouldmove:
+            repo._bookmarks[bm] = c.node()
+            repo._bookmarks.write()
         displayer.show(c)
         return 0
     else:
@@ -1624,22 +1635,22 @@
     _('[OPTION] [-r] REV...'))
     # -U  --noupdate option to prevent wc update and or bookmarks update ?
 def cmdprune(ui, repo, *revs, **opts):
-    """get rid of changesets by marking them obsolete
+    """hide changesets by marking them obsolete
 
     Obsolete changesets becomes invisible to all commands.
 
-    Non-pruned descendant of pruned changesets becomes "unstable". Use the
+    Unpruned descendants of pruned changesets becomes "unstable". Use the
     :hg:`evolve` to handle such situation.
 
-    When the working directory parent is pruned the repository is updated to a
-    non obsolete parents.
+    When the working directory parent is pruned, the repository is updated to a
+    non-obsolete parent.
 
-    You can use the ``--succ`` option to informs mercurial that a newer version
+    You can use the ``--succ`` option to inform mercurial that a newer version
     of the pruned changeset exists.
 
     You can use the ``--biject`` option to specify a 1-1 (bijection) between
     revisions to prune and successor changesets. This option may be removed in
-    a future release (with the functionality absored automatically).
+    a future release (with the functionality absorbed automatically).
 
     """
     revs = set(scmutil.revrange(repo, list(revs) + opts.get('rev')))
@@ -1837,10 +1848,10 @@
 def uncommit(ui, repo, *pats, **opts):
     """move changes from parent revision to working directory
 
-    Changes to selected files in parent revision appear again as
+    Changes to selected files in the checked out revision appear again as
     uncommitted changed in the working directory. A new revision
-    without selected changes is created, becomes the new parent and
-    obsoletes the previous one.
+    without the selected changes is created, becomes the checked out
+    revision, and obsoletes the previous one.
 
     The --include option specifies patterns to uncommit.
     The --exclude option specifies patterns to keep in the commit.
@@ -1921,7 +1932,7 @@
     # allow to choose the seed ?
     _('[-r] revs'))
 def touch(ui, repo, *revs, **opts):
-    """Create successors with exact same property but hash
+    """Create successors that are identical to their predecessors except for the changeset ID
 
     This is used to "resurrect" changesets
     """
@@ -1977,10 +1988,10 @@
 def fold(ui, repo, *revs, **opts):
     """Fold multiple revisions into a single one
 
-    Revision from your current working directory to the specified one are fold
-    as a new one replacing the other
+    The revisions from your current working directory to the given one are folded
+    into a single successor revision.
 
-    you can alternatively use --rev to explicitly specify revision to be fold
+    you can alternatively use --rev to explicitly specify revisions to be folded,
     ignoring the current working directory parent.
     """
     revs = list(revs)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-prev-next.t	Sun Apr 13 16:46:13 2014 -0400
@@ -0,0 +1,62 @@
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > hgext.rebase=
+  > hgext.graphlog=
+  > EOF
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
+
+hg prev should move active bookmark
+  $ hg init
+  $ touch a
+  $ hg add a
+  $ hg commit -m 'added a'
+  $ touch b
+  $ hg add b
+  $ hg commit -m 'added b'
+  $ hg bookmark mark
+  $ hg bookmarks
+   * mark                      1:6e742c9127b3
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [0] added a
+  $ hg bookmarks
+   * mark                      0:a154386e50d1
+
+hg next should move active bookmark
+  $ hg next
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [1] added b
+  $ hg bookmarks
+   * mark                      1:6e742c9127b3
+
+hg next/prev should not interfere with inactive bookmarks
+  $ touch c
+  $ hg add c
+  $ hg commit -m 'added c'
+  $ hg bookmark -r2 no-move
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [1] added b
+  $ hg bookmarks
+   * mark                      1:6e742c9127b3
+     no-move                   2:4e26ef31f919
+  $ hg next
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [2] added c
+  $ hg bookmarks
+   * mark                      2:4e26ef31f919
+     no-move                   2:4e26ef31f919
+  $ hg up 1
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg next
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [2] added c
+  $ hg bookmarks
+     mark                      2:4e26ef31f919
+     no-move                   2:4e26ef31f919
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [1] added b
+  $ hg bookmarks
+     mark                      2:4e26ef31f919
+     no-move                   2:4e26ef31f919
--- a/tests/test-tutorial.t	Mon Apr 07 16:41:29 2014 -0700
+++ b/tests/test-tutorial.t	Sun Apr 13 16:46:13 2014 -0400
@@ -444,9 +444,10 @@
   
   move changes from parent revision to working directory
   
-      Changes to selected files in parent revision appear again as uncommitted
-      changed in the working directory. A new revision without selected changes
-      is created, becomes the new parent and obsoletes the previous one.
+      Changes to selected files in the checked out revision appear again as
+      uncommitted changed in the working directory. A new revision without the
+      selected changes is created, becomes the checked out revision, and
+      obsoletes the previous one.
   
       The --include option specifies patterns to uncommit. The --exclude option
       specifies patterns to keep in the commit.
@@ -477,11 +478,11 @@
   
   Fold multiple revisions into a single one
   
-      Revision from your current working directory to the specified one are fold
-      as a new one replacing the other
+      The revisions from your current working directory to the given one are
+      folded into a single successor revision.
   
-      you can alternatively use --rev to explicitly specify revision to be fold
-      ignoring the current working directory parent.
+      you can alternatively use --rev to explicitly specify revisions to be
+      folded, ignoring the current working directory parent.
   
   options: