Show More
@@ -17,6 +17,7 b' merge, hg update).' | |||||
17 | ''' |
|
17 | ''' | |
18 |
|
18 | |||
19 | from mercurial.commands import templateopts, hex, short |
|
19 | from mercurial.commands import templateopts, hex, short | |
|
20 | from mercurial import extensions | |||
20 | from mercurial.i18n import _ |
|
21 | from mercurial.i18n import _ | |
21 | from mercurial import cmdutil, util, commands, changelog |
|
22 | from mercurial import cmdutil, util, commands, changelog | |
22 | from mercurial.node import nullid, nullrev |
|
23 | from mercurial.node import nullid, nullrev | |
@@ -220,6 +221,24 b' def reposetup(ui, repo):' | |||||
220 |
|
221 | |||
221 | repo.__class__ = bookmark_repo |
|
222 | repo.__class__ = bookmark_repo | |
222 |
|
223 | |||
|
224 | def pushnonbookmarked(orig, ui, repo, *args, **opts): | |||
|
225 | 'Call push with only the heads that are not bookmarked' | |||
|
226 | if opts.get('non_bookmarked'): | |||
|
227 | if opts.get('rev'): | |||
|
228 | heads = [repo.lookup(r) for r in opts.get('rev')] | |||
|
229 | else: | |||
|
230 | heads = repo.heads() | |||
|
231 | ||||
|
232 | markheads = parse(repo).values() | |||
|
233 | opts['rev'] = [head for head in heads if not(head in markheads)] | |||
|
234 | ||||
|
235 | orig(ui, repo, *args, **opts) | |||
|
236 | ||||
|
237 | def uisetup(ui): | |||
|
238 | 'Replace push with a decorator to provide --non-bookmarked option' | |||
|
239 | entry = extensions.wrapcommand(commands.table, 'push', pushnonbookmarked) | |||
|
240 | entry[1].append(('', 'non-bookmarked', None, _("push all heads that are not bookmarked"))) | |||
|
241 | ||||
223 | cmdtable = { |
|
242 | cmdtable = { | |
224 | "bookmarks": |
|
243 | "bookmarks": | |
225 | (bookmark, |
|
244 | (bookmark, |
General Comments 0
You need to be logged in to leave comments.
Login now