bookmarks: add 'hg pull -B .' for pulling the active bookmark (issue5258)
authorliscju <piotr.listkiewicz@gmail.com>
Wed, 01 Jun 2016 22:58:57 +0200
changeset 29376 113d0b23321a
parent 29375 fcaf20175b1b
child 29377 2c019aac6b99
bookmarks: add 'hg pull -B .' for pulling the active bookmark (issue5258)
mercurial/commands.py
mercurial/exchange.py
tests/test-bookmarks-pushpull.t
--- a/mercurial/commands.py	Sun Jun 19 02:17:33 2016 +0900
+++ b/mercurial/commands.py	Wed Jun 01 22:58:57 2016 +0200
@@ -5805,6 +5805,7 @@
             remotebookmarks = other.listkeys('bookmarks')
             pullopargs['remotebookmarks'] = remotebookmarks
             for b in opts['bookmark']:
+                b = repo._bookmarks.expandname(b)
                 if b not in remotebookmarks:
                     raise error.Abort(_('remote bookmark %s not found!') % b)
                 revs.append(remotebookmarks[b])
--- a/mercurial/exchange.py	Sun Jun 19 02:17:33 2016 +0900
+++ b/mercurial/exchange.py	Wed Jun 01 22:58:57 2016 +0200
@@ -1056,7 +1056,8 @@
         # revision we try to pull (None is "all")
         self.heads = heads
         # bookmark pulled explicitly
-        self.explicitbookmarks = bookmarks
+        self.explicitbookmarks = [repo._bookmarks.expandname(bookmark)
+                                  for bookmark in bookmarks]
         # do we force pull?
         self.force = force
         # whether a streaming clone was requested
--- a/tests/test-bookmarks-pushpull.t	Sun Jun 19 02:17:33 2016 +0900
+++ b/tests/test-bookmarks-pushpull.t	Wed Jun 01 22:58:57 2016 +0200
@@ -252,7 +252,10 @@
 
 explicit pull should overwrite the local version (issue4439)
 
-  $ hg pull --config paths.foo=../a foo -B X
+  $ hg update -r X
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (activating bookmark X)
+  $ hg pull --config paths.foo=../a foo -B .
   pulling from $TESTTMP/a (glob)
   no changes found
   divergent bookmark @ stored as @foo
@@ -366,7 +369,10 @@
      X                         1:0d2164f0ce0d
    * Y                         5:35d1ef0a8d1b
      Z                         1:0d2164f0ce0d
-  $ hg pull -B Y
+  $ hg update -r Y
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (activating bookmark Y)
+  $ hg pull -B .
   pulling from http://localhost:$HGPORT/
   searching for changes
   adding changesets
@@ -376,9 +382,9 @@
   updating bookmark Y
   (run 'hg update' to get a working copy)
   $ hg book
-   * @                         1:0d2164f0ce0d
+     @                         1:0d2164f0ce0d
      X                         1:0d2164f0ce0d
-     Y                         5:35d1ef0a8d1b
+   * Y                         5:35d1ef0a8d1b
      Z                         1:0d2164f0ce0d
 
 (done with this section of the test)