changeset 12614:f314723f36f5 stable

revset: fix #branch in urls for outgoing() hg log -r 'outgoing(..)' ignored #branch in some cases. This patch fixes it. The cases where it misbehaved are now covered by the added test-revset-outgoing.t
author Adrian Buehlmann <adrian@cadifra.com>
date Tue, 05 Oct 2010 11:34:13 +0200
parents 1f6bd49383b3
children 64db820c66a2 89df79b3c011
files mercurial/revset.py tests/test-revset-outgoing.t
diffstat 2 files changed, 96 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Oct 01 10:18:57 2010 -0500
+++ b/mercurial/revset.py	Tue Oct 05 11:34:13 2010 +0200
@@ -435,12 +435,15 @@
     dest = l and getstring(l[0], _("outgoing wants a repository path")) or ''
     dest = repo.ui.expandpath(dest or 'default-push', dest or 'default')
     dest, branches = hg.parseurl(dest)
+    revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
+    if revs:
+        revs = [repo.lookup(rev) for rev in revs]
     other = hg.repository(hg.remoteui(repo, {}), dest)
     repo.ui.pushbuffer()
     o = discovery.findoutgoing(repo, other)
     repo.ui.popbuffer()
     cl = repo.changelog
-    o = set([cl.rev(r) for r in repo.changelog.nodesbetween(o, None)[0]])
+    o = set([cl.rev(r) for r in repo.changelog.nodesbetween(o, revs)[0]])
     return [r for r in subset if r in o]
 
 def tagged(repo, subset, x):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-revset-outgoing.t	Tue Oct 05 11:34:13 2010 +0200
@@ -0,0 +1,92 @@
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > graphlog=
+  > 
+  > [alias]
+  > tlog = log --template "{rev}:{node|short}: '{desc}' {branches}\n"
+  > tglog = tlog -G
+  > tout = out --template "{rev}:{node|short}: '{desc}' {branches}\n"
+  > EOF
+
+  $ hg init a
+  $ cd a
+
+  $ echo a > a
+  $ hg ci -Aqm0
+
+  $ echo foo >> a
+  $ hg ci -Aqm1
+
+  $ hg up -q 0
+
+  $ hg branch stable
+  marked working directory as branch stable
+  $ echo bar >> a
+  $ hg ci -qm2
+
+  $ hg tglog
+  @  2:7bee6c3bea3a: '2' stable
+  |
+  | o  1:3560197d8331: '1'
+  |/
+  o  0:f7b1eb17ad24: '0'
+  
+
+  $ cd ..
+
+  $ hg clone -q a#stable b
+
+  $ cd b
+  $ cat .hg/hgrc
+  [paths]
+  default = */a#stable (glob)
+
+  $ echo red >> a
+  $ hg ci -qm3
+
+  $ hg up -q default
+
+  $ echo blue >> a
+  $ hg ci -qm4
+
+  $ hg tglog
+  @  3:f0461977a3db: '4'
+  |
+  | o  2:1d4099801a4e: '3' stable
+  | |
+  | o  1:7bee6c3bea3a: '2' stable
+  |/
+  o  0:f7b1eb17ad24: '0'
+  
+
+  $ hg tout
+  comparing with */a (glob)
+  searching for changes
+  2:1d4099801a4e: '3' stable
+
+  $ hg tlog -r 'outgoing()'
+  2:1d4099801a4e: '3' stable
+
+  $ hg tout ../a#default
+  comparing with ../a
+  searching for changes
+  3:f0461977a3db: '4' 
+
+  $ hg tlog -r 'outgoing("../a#default")'
+  3:f0461977a3db: '4' 
+
+  $ echo "green = ../a#default" >> .hg/hgrc
+
+  $ cat .hg/hgrc
+  [paths]
+  default = */a#stable (glob)
+  green = ../a#default
+
+  $ hg tout green
+  comparing with */a (glob)
+  searching for changes
+  3:f0461977a3db: '4' 
+
+  $ hg tlog -r 'outgoing("green")'
+  3:f0461977a3db: '4' 
+