##// END OF EJS Templates
bookmarks: add 'hg push -B .' for pushing the active bookmark (issue4917)
liscju -
r28182:e4fe4e90 default
parent child Browse files
Show More
@@ -182,6 +182,11 b' class bmstore(dict):'
182 fp.write("%s %s\n" % (hex(node), encoding.fromlocal(name)))
182 fp.write("%s %s\n" % (hex(node), encoding.fromlocal(name)))
183 self._clean = True
183 self._clean = True
184
184
185 def expandname(self, bname):
186 if bname == '.':
187 return self.active
188 return bname
189
185 def _readactive(repo, marks):
190 def _readactive(repo, marks):
186 """
191 """
187 Get the active bookmark. We can have an active bookmark that updates
192 Get the active bookmark. We can have an active bookmark that updates
@@ -5708,7 +5708,8 b' def push(ui, repo, dest=None, **opts):'
5708
5708
5709 If -B/--bookmark is used, the specified bookmarked revision, its
5709 If -B/--bookmark is used, the specified bookmarked revision, its
5710 ancestors, and the bookmark will be pushed to the remote
5710 ancestors, and the bookmark will be pushed to the remote
5711 repository.
5711 repository. Specifying ``.`` is equivalent to specifying the active
5712 bookmark's name.
5712
5713
5713 Please see :hg:`help urls` for important details about ``ssh://``
5714 Please see :hg:`help urls` for important details about ``ssh://``
5714 URLs. If DESTINATION is omitted, a default path will be used.
5715 URLs. If DESTINATION is omitted, a default path will be used.
@@ -5720,6 +5721,7 b' def push(ui, repo, dest=None, **opts):'
5720 ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push')
5721 ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push')
5721 for b in opts['bookmark']:
5722 for b in opts['bookmark']:
5722 # translate -B options to -r so changesets get pushed
5723 # translate -B options to -r so changesets get pushed
5724 b = repo._bookmarks.expandname(b)
5723 if b in repo._bookmarks:
5725 if b in repo._bookmarks:
5724 opts.setdefault('rev', []).append(b)
5726 opts.setdefault('rev', []).append(b)
5725 else:
5727 else:
@@ -576,7 +576,8 b' def _pushdiscoverybookmarks(pushop):'
576 ancestors = repo.changelog.ancestors(revnums, inclusive=True)
576 ancestors = repo.changelog.ancestors(revnums, inclusive=True)
577 remotebookmark = remote.listkeys('bookmarks')
577 remotebookmark = remote.listkeys('bookmarks')
578
578
579 explicit = set(pushop.bookmarks)
579 explicit = set([repo._bookmarks.expandname(bookmark)
580 for bookmark in pushop.bookmarks])
580
581
581 comp = bookmod.compare(repo, repo._bookmarks, remotebookmark, srchex=hex)
582 comp = bookmod.compare(repo, repo._bookmarks, remotebookmark, srchex=hex)
582 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = comp
583 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = comp
@@ -103,6 +103,29 b' delete a remote bookmark'
103 deleting remote bookmark W
103 deleting remote bookmark W
104 [1]
104 [1]
105
105
106 export the active bookmark
107
108 $ hg bookmark V
109 $ hg push -B . ../a
110 pushing to ../a
111 searching for changes
112 no changes found
113 exporting bookmark V
114 [1]
115
116 delete the bookmark
117
118 $ hg book -d V
119 $ hg push -B V ../a
120 pushing to ../a
121 searching for changes
122 no changes found
123 deleting remote bookmark V
124 [1]
125 $ hg up foobar
126 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
127 (activating bookmark foobar)
128
106 push/pull name that doesn't exist
129 push/pull name that doesn't exist
107
130
108 $ hg push -B badname ../a
131 $ hg push -B badname ../a
General Comments 0
You need to be logged in to leave comments. Login now