Patchwork [3,of,4,STABLE] subrepo: don't pass the outer repo's --rev or --branch to subrepo incoming()

login
register
mail settings
Submitter Matt Harbison
Date April 28, 2015, 3:18 a.m.
Message ID <563baf18e9d05b9717db.1430191115@Envy>
Download mbox | patch
Permalink /patch/8810/
State Accepted
Headers show

Comments

Matt Harbison - April 28, 2015, 3:18 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1430184863 14400
#      Mon Apr 27 21:34:23 2015 -0400
# Branch stable
# Node ID 563baf18e9d05b9717db864533bab51368d38d7e
# Parent  e220f78c575806a8f436ca9070f714d2a6306b3e
subrepo: don't pass the outer repo's --rev or --branch to subrepo incoming()

When passing a --rev, 'hg incoming -S' previously suffered from the same output
truncation or abort that was fixed for 'hg outgoing -S' in the previous patch,
for the same reasons.

Unlike push, subrepos are currently only pulled when the outer repo is updated,
not when the outer repo is pulled.  That makes matching 'hg pull' behavior
impossible.  Listing all incoming csets in the subrepo seems like the most
useful behavior, and is consistent with 'hg outgoing -S'.

Patch

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -881,6 +881,10 @@ 
 
     @annotatesubrepoerror
     def incoming(self, ui, source, opts):
+        if 'rev' in opts or 'branch' in opts:
+            opts = copy.copy(opts)
+            opts.pop('rev', None)
+            opts.pop('branch', None)
         return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts)
 
     @annotatesubrepoerror
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -689,6 +689,24 @@ 
 
 should pull t
 
+  $ hg incoming -S -r `hg log -r tip -T "{node|short}"`
+  comparing with $TESTTMP/t (glob)
+  no changes found
+  comparing with $TESTTMP/t/s
+  searching for changes
+  no changes found
+  comparing with $TESTTMP/t/s/ss
+  searching for changes
+  no changes found
+  comparing with $TESTTMP/t/t
+  searching for changes
+  changeset:   5:52c0adc0515a
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     13
+  
+
   $ hg up
   pulling subrepo t from $TESTTMP/t/t
   searching for changes