Patchwork [3,of,3,STABLE] summary: make "incoming" information sensitive to branch in URL (issue3830)

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Feb. 17, 2013, 3:26 p.m.
Message ID <606365294a9994c715fb.1361114797@juju>
Download mbox | patch
Permalink /patch/1025/
State Superseded
Headers show

Comments

Katsunori FUJIWARA - Feb. 17, 2013, 3:26 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1361113469 -32400
# Branch stable
# Node ID 606365294a9994c715fb426a7efb37b68de9b46e
# Parent  373c150caa5f20ae975e086b8f211811afbd1687
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.

"hg summary" invokes "discovery.findcommonincoming()" without "heads"
argument, so it returns revisions on branches other than the one
specified in the URL, too.

This patch looks head revisions up against "other" repository, and
invokes "discovery.findcommonincoming()" with list of them as "heads"
to limit calculation of incoming revisions.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5677,9 +5677,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:
diff --git a/tests/test-url-rev.t b/tests/test-url-rev.t
--- a/tests/test-url-rev.t
+++ b/tests/test-url-rev.t
@@ -100,6 +100,16 @@ 
   update: (current)
   remote: 1 outgoing
 
+  $ hg -q --cwd ../clone incoming
+  2:faba9097cad4
+  $ hg --cwd ../clone summary --remote
+  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
+  [1]
+  $ hg --cwd ../clone summary --remote
+  parent: 1:cd2a86ecc814 
+   change a
+  branch: foo
+  commit: (clean)
+  update: 1 new changesets (update)
+  remote: (synced)
+
   $ cd ..
 
   $ cd clone