diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2672,7 +2672,13 @@ def outgoing(ui, repo, dest=None, **opts 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 @@ table = { ('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, diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -264,6 +264,9 @@ class abstractsubrepo(object): 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 @@ class hgsubrepo(abstractsubrepo): 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 diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t --- a/tests/test-debugcomplete.t +++ b/tests/test-debugcomplete.t @@ -230,7 +230,7 @@ Show all commands + options 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: diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t --- a/tests/test-subrepo-recursion.t +++ b/tests/test-subrepo-recursion.t @@ -6,7 +6,8 @@ Make status look into subrepositories by Create test repository: - $ hg init + $ hg init repo + $ cd repo $ echo x1 > x.txt $ hg init foo @@ -225,3 +226,64 @@ Status between revisions: @@ -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 +