bookmarks: merge incoming/outgoing into core
authorMatt Mackall <mpm@selenic.com>
Thu, 10 Feb 2011 13:46:28 -0600
changeset 13366 c756e9166417
parent 13365 f1c5294e9119
child 13367 cef73cd9c268
bookmarks: merge incoming/outgoing into core
hgext/bookmarks.py
mercurial/commands.py
tests/test-debugcomplete.t
--- a/hgext/bookmarks.py	Thu Feb 10 13:46:28 2011 -0600
+++ b/hgext/bookmarks.py	Thu Feb 10 13:46:28 2011 -0600
@@ -195,25 +195,6 @@
 
     return result
 
-def incoming(oldincoming, ui, repo, source="default", **opts):
-    if opts.get('bookmarks'):
-        source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
-        other = hg.repository(hg.remoteui(repo, opts), source)
-        ui.status(_('comparing with %s\n') % url.hidepassword(source))
-        return bookmarks.diff(ui, repo, other)
-    else:
-        return oldincoming(ui, repo, source, **opts)
-
-def outgoing(oldoutgoing, ui, repo, dest=None, **opts):
-    if opts.get('bookmarks'):
-        dest = ui.expandpath(dest or 'default-push', dest or 'default')
-        dest, branches = hg.parseurl(dest, opts.get('branch'))
-        other = hg.repository(hg.remoteui(repo, opts), dest)
-        ui.status(_('comparing with %s\n') % url.hidepassword(dest))
-        return bookmarks.diff(ui, other, repo)
-    else:
-        return oldoutgoing(ui, repo, dest, **opts)
-
 def uisetup(ui):
     if ui.configbool('bookmarks', 'track.current'):
         extensions.wrapcommand(commands.table, 'update', updatecurbookmark)
@@ -226,12 +207,6 @@
     entry[1].append(('B', 'bookmark', [],
                      _("bookmark to export"),
                      _('BOOKMARK')))
-    entry = extensions.wrapcommand(commands.table, 'incoming', incoming)
-    entry[1].append(('B', 'bookmarks', False,
-                     _("compare bookmark")))
-    entry = extensions.wrapcommand(commands.table, 'outgoing', outgoing)
-    entry[1].append(('B', 'bookmarks', False,
-                     _("compare bookmark")))
 
 def updatecurbookmark(orig, ui, repo, *args, **opts):
     '''Set the current bookmark
--- a/mercurial/commands.py	Thu Feb 10 13:46:28 2011 -0600
+++ b/mercurial/commands.py	Thu Feb 10 13:46:28 2011 -0600
@@ -9,7 +9,7 @@
 from lock import release
 from i18n import _, gettext
 import os, re, sys, difflib, time, tempfile
-import hg, util, revlog, extensions, copies, error
+import hg, util, revlog, extensions, copies, error, bookmarks
 import patch, help, mdiff, url, encoding, templatekw, discovery
 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server
 import merge as mergemod
@@ -2399,6 +2399,13 @@
     if opts.get('bundle') and opts.get('subrepos'):
         raise util.Abort(_('cannot combine --bundle and --subrepos'))
 
+    if opts.get('bookmarks'):
+        source, branches = hg.parseurl(ui.expandpath(source),
+                                       opts.get('branch'))
+        other = hg.repository(hg.remoteui(repo, opts), source)
+        ui.status(_('comparing with %s\n') % url.hidepassword(source))
+        return bookmarks.diff(ui, repo, other)
+
     ret = hg.incoming(ui, repo, source, opts)
     return ret
 
@@ -2675,6 +2682,14 @@
 
     Returns 0 if there are outgoing changes, 1 otherwise.
     """
+
+    if opts.get('bookmarks'):
+        dest = ui.expandpath(dest or 'default-push', dest or 'default')
+        dest, branches = hg.parseurl(dest, opts.get('branch'))
+        other = hg.repository(hg.remoteui(repo, opts), dest)
+        ui.status(_('comparing with %s\n') % url.hidepassword(dest))
+        return bookmarks.diff(ui, other, repo)
+
     ret = hg.outgoing(ui, repo, dest, opts)
     return ret
 
@@ -4287,6 +4302,7 @@
            _('file to store the bundles into'), _('FILE')),
           ('r', 'rev', [],
            _('a remote changeset intended to be added'), _('REV')),
+          ('B', 'bookmarks', False, _("compare bookmarks")),
           ('b', 'branch', [],
            _('a specific branch you would like to pull'), _('BRANCH')),
          ] + logopts + remoteopts + subrepoopts,
@@ -4355,6 +4371,7 @@
            _('a changeset intended to be included in the destination'),
            _('REV')),
           ('n', 'newest-first', None, _('show newest record first')),
+          ('B', 'bookmarks', False, _("compare bookmarks")),
           ('b', 'branch', [],
            _('a specific branch you would like to push'), _('BRANCH')),
          ] + logopts + remoteopts + subrepoopts,
--- a/tests/test-debugcomplete.t	Thu Feb 10 13:46:28 2011 -0600
+++ b/tests/test-debugcomplete.t	Thu Feb 10 13:46:28 2011 -0600
@@ -228,10 +228,10 @@
   help: 
   identify: rev, num, id, branch, tags
   import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity
-  incoming: force, newest-first, bundle, rev, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
+  incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
   locate: rev, print0, fullpath, include, exclude
   manifest: rev
-  outgoing: force, rev, newest-first, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
+  outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, insecure, subrepos
   parents: rev, style, template
   paths: 
   recover: