Mercurial > hg-stable
changeset 12272:42ecd56399d7
outgoing: recurse into subrepositories with --subrepos/-S flag
As with push, the optional destination path is ignored for the
subrepositories, i.e., they are always compared with their default
push path. Fixing this is Issue1852.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Mon, 13 Sep 2010 13:09:26 +0200 |
parents | 01dc8ba3e032 |
children | e392d00ab5b0 |
files | mercurial/commands.py mercurial/subrepo.py tests/test-debugcomplete.t tests/test-subrepo-recursion.t |
diffstat | 4 files changed, 78 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Sep 13 13:09:24 2010 +0200 +++ b/mercurial/commands.py Mon Sep 13 13:09:26 2010 +0200 @@ -2672,7 +2672,13 @@ Returns 0 if there are outgoing changes, 1 otherwise. """ - return hg.outgoing(ui, repo, dest, opts) + ret = hg.outgoing(ui, repo, dest, opts) + if opts.get('subrepos'): + ctx = repo[None] + for subpath in sorted(ctx.substate): + sub = ctx.sub(subpath) + ret = min(ret, sub.outgoing(ui, dest, opts)) + return ret def parents(ui, repo, file_=None, **opts): """show the parents of the working directory or revision @@ -4311,7 +4317,7 @@ ('n', 'newest-first', None, _('show newest record first')), ('b', 'branch', [], _('a specific branch you would like to push'), _('BRANCH')), - ] + logopts + remoteopts, + ] + logopts + remoteopts + subrepoopts, _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')), "parents": (parents,
--- a/mercurial/subrepo.py Mon Sep 13 13:09:24 2010 +0200 +++ b/mercurial/subrepo.py Mon Sep 13 13:09:26 2010 +0200 @@ -264,6 +264,9 @@ def diff(self, diffopts, node2, match, prefix, **opts): pass + def outgoing(self, ui, dest, opts): + return 1 + class hgsubrepo(abstractsubrepo): def __init__(self, ctx, path, state): self._path = path @@ -394,6 +397,9 @@ other = hg.repository(self._repo.ui, dsturl) return self._repo.push(other, force) + def outgoing(self, ui, dest, opts): + return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts) + class svnsubrepo(abstractsubrepo): def __init__(self, ctx, path, state): self._path = path
--- a/tests/test-debugcomplete.t Mon Sep 13 13:09:24 2010 +0200 +++ b/tests/test-debugcomplete.t Mon Sep 13 13:09:26 2010 +0200 @@ -230,7 +230,7 @@ incoming: force, newest-first, bundle, rev, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd locate: rev, print0, fullpath, include, exclude manifest: rev - outgoing: force, rev, newest-first, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd + outgoing: force, rev, newest-first, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, subrepos parents: rev, style, template paths: recover:
--- a/tests/test-subrepo-recursion.t Mon Sep 13 13:09:24 2010 +0200 +++ b/tests/test-subrepo-recursion.t Mon Sep 13 13:09:26 2010 +0200 @@ -6,7 +6,8 @@ Create test repository: - $ hg init + $ hg init repo + $ cd repo $ echo x1 > x.txt $ hg init foo @@ -225,3 +226,64 @@ @@ -1,1 +1,2 @@ z1 +z2 + +Clone and test outgoing: + + $ cd .. + $ hg clone repo repo2 + updating to branch default + pulling subrepo foo from .*/test-subrepo-recursion.t/repo/foo + requesting all changes + adding changesets + adding manifests + adding file changes + added 4 changesets with 7 changes to 3 files + pulling subrepo foo/bar from .*/test-subrepo-recursion.t/repo/foo/bar + requesting all changes + adding changesets + adding manifests + adding file changes + added 3 changesets with 3 changes to 1 files + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd repo2 + $ hg outgoing -S + comparing with .*/test-subrepo-recursion.t/repo + searching for changes + no changes found + comparing with .*/test-subrepo-recursion.t/repo/foo + searching for changes + no changes found + $ echo $? + 0 + +Make nested change: + + $ echo y4 >> foo/y.txt + $ hg diff + diff -r 65903cebad86 foo/y.txt + --- a/foo/y.txt + +++ b/foo/y.txt + @@ -1,3 +1,4 @@ + y1 + y2 + y3 + +y4 + $ hg commit -m 3-4-2 + committing subrepository foo + $ hg outgoing -S + comparing with .*/test-subrepo-recursion.t/repo + searching for changes + changeset: 3:2655b8ecc4ee + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: 3-4-2 + + comparing with .*/test-subrepo-recursion.t/repo/foo + searching for changes + changeset: 4:e96193d6cb36 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: 3-4-2 +