segv / bookmarks (http://selenic.com/hg/)

fork of mercurial

Repository containing maintenance changes for the bookmark extensions, bundled with mercurial.

Clone this repository (size: 11.9 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/segv/bookmarks/
commit 7468: 4c3e0ad58c5b
parent 7318: 95e1260b8134
branch: default
bookmarks: Adds support for a --non-bookmarked option to push
Stefan Rusek / stefanrusek
7 months ago

Changed (Δ733 bytes):

raw changeset »

hgext/bookmarks.py (19 lines added, 0 lines removed)

Up to file-list hgext/bookmarks.py:

@@ -17,6 +17,7 @@ merge, hg update).
17
17
'''
18
18
19
19
from mercurial.commands import templateopts, hex, short
20
from mercurial import extensions
20
21
from mercurial.i18n import _
21
22
from mercurial import cmdutil, util, commands, changelog
22
23
from mercurial.node import nullid, nullrev
@@ -220,6 +221,24 @@ def reposetup(ui, repo):
220
221
221
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
242
cmdtable = {
224
243
    "bookmarks":
225
244
        (bookmark,