changeset 11472:5b89c20e0c0b stable

Merge with stable
author Wagner Bruna <wbruna@softwareexpress.com.br>
date Tue, 22 Jun 2010 20:48:48 -0300
parents 4da206812ce7 (current diff) 2186124f08e4 (diff)
children 469a48dff18b
files
diffstat 3 files changed, 40 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bookmarks.py	Tue Jun 22 09:43:07 2010 +0200
+++ b/hgext/bookmarks.py	Tue Jun 22 20:48:48 2010 -0300
@@ -30,7 +30,7 @@
 
 from mercurial.i18n import _
 from mercurial.node import nullid, nullrev, hex, short
-from mercurial import util, commands, repair, extensions, pushkey, hg
+from mercurial import util, commands, repair, extensions, pushkey, hg, url
 import os
 
 def write(repo):
@@ -445,6 +445,37 @@
 
     return result
 
+def diffbookmarks(ui, repo, remote):
+    ui.status(_("searching for changes\n"))
+
+    lmarks = repo.listkeys('bookmarks')
+    rmarks = remote.listkeys('bookmarks')
+
+    diff = set(rmarks) - set(lmarks)
+    for k in diff:
+        ui.write("   %-25s %s\n" % (k, rmarks[k][:12]))
+
+    if len(diff) <= 0:
+        ui.status(_("no changes found\n"))
+
+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))
+        diffbookmarks(ui, repo, other)
+    else:
+        oldincoming(ui, repo, source, **opts)
+
+def outgoing(oldoutgoing, 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))
+        diffbookmarks(ui, other, repo)
+    else:
+        oldoutgoing(ui, repo, source, **opts)
+
 def uisetup(ui):
     extensions.wrapfunction(repair, "strip", strip)
     if ui.configbool('bookmarks', 'track.current'):
@@ -456,6 +487,12 @@
     entry = extensions.wrapcommand(commands.table, 'push', push)
     entry[1].append(('B', 'bookmark', [],
                      _("bookmark to export")))
+    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")))
 
     pushkey.register('bookmarks', pushbookmark, listbookmarks)
 
--- a/i18n/polib.py	Tue Jun 22 09:43:07 2010 +0200
+++ b/i18n/polib.py	Tue Jun 22 20:48:48 2010 -0300
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
+# no-check-code
 #
 # License: MIT (see LICENSE file provided)
 # vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
--- a/mercurial/discovery.py	Tue Jun 22 09:43:07 2010 +0200
+++ b/mercurial/discovery.py	Tue Jun 22 20:48:48 2010 -0300
@@ -280,7 +280,7 @@
             remotemap = remote.branchmap()
             newbranches = branches - set(remotemap)
             if newbranches and not newbranch: # new branch requires --new-branch
-                branchnames = ', '.join("%s" % b for b in newbranches)
+                branchnames = ', '.join(sorted(newbranches))
                 repo.ui.warn(_("abort: push creates "
                                "new remote branches: %s!\n")
                              % branchnames)