Show More
@@ -30,7 +30,7 b' branching.' | |||
|
30 | 30 | |
|
31 | 31 | from mercurial.i18n import _ |
|
32 | 32 | from mercurial.node import nullid, nullrev, hex, short |
|
33 | from mercurial import util, commands, repair, extensions, pushkey, hg | |
|
33 | from mercurial import util, commands, repair, extensions, pushkey, hg, url | |
|
34 | 34 | import os |
|
35 | 35 | |
|
36 | 36 | def write(repo): |
@@ -445,6 +445,37 b' def push(oldpush, ui, repo, dest=None, *' | |||
|
445 | 445 | |
|
446 | 446 | return result |
|
447 | 447 | |
|
448 | def diffbookmarks(ui, repo, remote): | |
|
449 | ui.status(_("searching for changes\n")) | |
|
450 | ||
|
451 | lmarks = repo.listkeys('bookmarks') | |
|
452 | rmarks = remote.listkeys('bookmarks') | |
|
453 | ||
|
454 | diff = set(rmarks) - set(lmarks) | |
|
455 | for k in diff: | |
|
456 | ui.write(" %-25s %s\n" % (k, rmarks[k][:12])) | |
|
457 | ||
|
458 | if len(diff) <= 0: | |
|
459 | ui.status(_("no changes found\n")) | |
|
460 | ||
|
461 | def incoming(oldincoming, ui, repo, source="default", **opts): | |
|
462 | if opts.get('bookmarks'): | |
|
463 | source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) | |
|
464 | other = hg.repository(hg.remoteui(repo, opts), source) | |
|
465 | ui.status(_('comparing with %s\n') % url.hidepassword(source)) | |
|
466 | diffbookmarks(ui, repo, other) | |
|
467 | else: | |
|
468 | oldincoming(ui, repo, source, **opts) | |
|
469 | ||
|
470 | def outgoing(oldoutgoing, ui, repo, source="default", **opts): | |
|
471 | if opts.get('bookmarks'): | |
|
472 | source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) | |
|
473 | other = hg.repository(hg.remoteui(repo, opts), source) | |
|
474 | ui.status(_('comparing with %s\n') % url.hidepassword(source)) | |
|
475 | diffbookmarks(ui, other, repo) | |
|
476 | else: | |
|
477 | oldoutgoing(ui, repo, source, **opts) | |
|
478 | ||
|
448 | 479 | def uisetup(ui): |
|
449 | 480 | extensions.wrapfunction(repair, "strip", strip) |
|
450 | 481 | if ui.configbool('bookmarks', 'track.current'): |
@@ -456,6 +487,12 b' def uisetup(ui):' | |||
|
456 | 487 | entry = extensions.wrapcommand(commands.table, 'push', push) |
|
457 | 488 | entry[1].append(('B', 'bookmark', [], |
|
458 | 489 | _("bookmark to export"))) |
|
490 | entry = extensions.wrapcommand(commands.table, 'incoming', incoming) | |
|
491 | entry[1].append(('B', 'bookmarks', False, | |
|
492 | _("compare bookmark"))) | |
|
493 | entry = extensions.wrapcommand(commands.table, 'outgoing', outgoing) | |
|
494 | entry[1].append(('B', 'bookmarks', False, | |
|
495 | _("compare bookmark"))) | |
|
459 | 496 | |
|
460 | 497 | pushkey.register('bookmarks', pushbookmark, listbookmarks) |
|
461 | 498 |
General Comments 0
You need to be logged in to leave comments.
Login now