summary: make "incoming" information sensitive to branch in URL (issue3830)
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 09 Apr 2013 23:40:11 +0900
changeset 18996 160d8416e286
parent 18995 0023a6e49268
child 18997 4cf09a1bf5b2
summary: make "incoming" information sensitive to branch in URL (issue3830) Before this patch, "incoming" information of "hg summary --remote" is not sensitive to the branch specified in the URL of the destination repository, even though "hg pull"/"hg incoming" are so. Invocation of "discovery.findcommonincoming()" without "heads" argument treats revisions on branches other than the one specified in the URL as incoming ones unexpectedly. This patch looks head revisions, which are already detected by "hg.addbranchrevs()" from URL, up against "other" repository, and invokes "discovery.findcommonincoming()" with list of them as "heads" to limit calculation of incoming revisions.
mercurial/commands.py
tests/test-url-rev.t
--- a/mercurial/commands.py	Tue Apr 09 23:40:10 2013 +0900
+++ b/mercurial/commands.py	Tue Apr 09 23:40:11 2013 +0900
@@ -5467,9 +5467,11 @@
         other = hg.peer(repo, {}, source)
         revs, checkout = hg.addbranchrevs(repo, other, branches,
                                           opts.get('rev'))
+        if revs:
+            revs = [other.lookup(rev) for rev in revs]
         ui.debug('comparing with %s\n' % util.hidepassword(source))
         repo.ui.pushbuffer()
-        commoninc = discovery.findcommonincoming(repo, other)
+        commoninc = discovery.findcommonincoming(repo, other, heads=revs)
         _common, incoming, _rheads = commoninc
         repo.ui.popbuffer()
         if incoming:
--- a/tests/test-url-rev.t	Tue Apr 09 23:40:10 2013 +0900
+++ b/tests/test-url-rev.t	Tue Apr 09 23:40:11 2013 +0900
@@ -100,6 +100,16 @@
   update: (current)
   remote: 1 outgoing
 
+  $ hg -q --cwd ../clone incoming '../repo#foo'
+  2:faba9097cad4
+  $ hg --cwd ../clone summary --remote --config paths.default='../repo#foo'
+  parent: 1:cd2a86ecc814 tip
+   change a
+  branch: foo
+  commit: (clean)
+  update: (current)
+  remote: 1 or more incoming
+
   $ hg -q push '../clone#foo'
 
   $ hg --cwd ../clone heads
@@ -115,6 +125,16 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     add a
   
+  $ hg -q --cwd ../clone incoming '../repo#foo'
+  [1]
+  $ hg --cwd ../clone summary --remote --config paths.default='../repo#foo'
+  parent: 1:cd2a86ecc814 
+   change a
+  branch: foo
+  commit: (clean)
+  update: 1 new changesets (update)
+  remote: (synced)
+
   $ cd ..
 
   $ cd clone