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

login
register
mail settings
Submitter Matt Harbison
Date April 28, 2015, 3:18 a.m.
Message ID <e220f78c575806a8f436.1430191114@Envy>
Download mbox | patch
Permalink /patch/8809/
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 1430183725 14400
#      Mon Apr 27 21:15:25 2015 -0400
# Branch stable
# Node ID e220f78c575806a8f436ca9070f714d2a6306b3e
# Parent  a6e1457cd2ec16cb77b2e05d32b92e4ea1609b48
subrepo: don't pass the outer repo's --rev or --branch to subrepo outgoing()

The previous behavior didn't reflect what would actually be pushed- push will
ignore --rev and --branch in the subrepo and push everything.  Therefore,
'push -r {rev}' would not list everything, unless {rev} was also the revision of
the subrepo's tip.  Worse, if a hash was passed in, the command would abort
because that hash would either not be in the outer repo or not in the subrepo.

Patch

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -873,6 +873,10 @@ 
 
     @annotatesubrepoerror
     def outgoing(self, ui, dest, opts):
+        if 'rev' in opts or 'branch' in opts:
+            opts = copy.copy(opts)
+            opts.pop('rev', None)
+            opts.pop('branch', None)
         return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts)
 
     @annotatesubrepoerror
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -598,6 +598,26 @@ 
 
   $ echo foo >> s/ss/a
   $ hg -R s/ss commit -m 'test dirty store detection'
+
+  $ hg out -S -r `hg log -r tip -T "{node|short}"`
+  comparing with $TESTTMP/t (glob)
+  searching for changes
+  no changes found
+  comparing with $TESTTMP/t/s
+  searching for changes
+  no changes found
+  comparing with $TESTTMP/t/s/ss
+  searching for changes
+  changeset:   1:79ea5566a333
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     test dirty store detection
+  
+  comparing with $TESTTMP/t/t
+  searching for changes
+  no changes found
+
   $ hg push
   pushing to $TESTTMP/t (glob)
   pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)