# HG changeset patch # User Simon Law # Date 1188237110 14400 # Node ID 148376451559550c0905ea5121e796bc009656c7 # Parent cb22e7675abc39d702a95c0f10b278e19961f19c Added `hg fincoming` and `hg foutgoing` You can now see what you're about to fpull or fpush. diff -r cb22e7675abc -r 148376451559 forest.py --- a/forest.py Mon Aug 27 13:50:49 2007 -0400 +++ b/forest.py Mon Aug 27 13:51:50 2007 -0400 @@ -801,6 +801,82 @@ ui.status("\n") +def incoming(ui, top, source="default", **opts): + """show new changesets found in source forest + + Show new changesets found in the specified path/URL or the default + pull location for each repository in the source forest. + + Look at the help text for the incoming command for more information. + """ + die_on_numeric_revs(opts['rev']) + forest = Forest(top=top, snapfile=opts['snapfile'], + walkhg=walkhgenabled(ui, opts['walkhg'])) + source = [source] + opts["bundle"] = "" + + def function(tree, srcpath, opts): + if not srcpath: + srcpath = forest.top().getpath(source) + if srcpath: + rpath = util.pconvert(relpath(forest.top().root, tree.root)) + srcpath = '/'.join((srcpath, rpath)) + else: + ui.warn(_("skipped: %s\n") % + _("repository %s not found") % source[0]) + return + try: + commands.incoming(ui, tree.repo, srcpath, **opts) + except Exception, err: + ui.warn(_("skipped: %s\n") % err) + + @Forest.Tree.warn + def check_mq(tree): + tree.die_on_mq(top.root) + + forest.apply(ui, function, source, opts, + prehooks=[lambda tree: check_mq(tree)]) + + +def outgoing(ui, top, dest=None, **opts): + """show changesets not found in destination forest + + Show changesets not found in the specified destination forest or + the default push location. + + Look at the help text for the outgoing command for more information. + """ + die_on_numeric_revs(opts['rev']) + forest = Forest(top=top, snapfile=opts['snapfile'], + walkhg=walkhgenabled(ui, opts['walkhg'])) + if dest == None: + dest = ["default-push", "default"] + else: + dest = [dest] + + def function(tree, destpath, opts): + if not destpath: + destpath = forest.top().getpath(dest) + if destpath: + rpath = util.pconvert(relpath(forest.top().root, tree.root)) + destpath = '/'.join((destpath, rpath)) + else: + ui.warn(_("skipped: %s\n") % + _("repository %s not found") % dest[0]) + return + try: + commands.outgoing(ui, tree.repo, destpath, **opts) + except Exception, err: + ui.warn(_("skipped: %s\n") % err) + + @Forest.Tree.warn + def check_mq(tree): + tree.die_on_mq(top.root) + + forest.apply(ui, function, dest, opts, + prehooks=[lambda tree: check_mq(tree)]) + + def pull(ui, top, source="default", pathalias=None, **opts): """pull changes from the specified forest @@ -1138,6 +1214,16 @@ (clone, [walkhgopts] + cmd_options(ui, 'clone'), _('hg fclone [OPTION]... SOURCE [DEST]')), + "fincoming|fin" : + (incoming, + [walkhgopts, snapfileopts] + + cmd_options(ui, 'incoming', remove=('f', 'bundle')), + _('hg fincoming [OPTION]... [SOURCE]')), + "foutgoing|fout" : + (outgoing, + [walkhgopts, snapfileopts] + + cmd_options(ui, 'outgoing', remove=('f',)), + _('hg foutgoing [OPTION]... [DEST]')), "^fpull" : (pull, [walkhgopts, snapfileopts] + cmd_options(ui, 'pull', remove=('f',)), diff -r cb22e7675abc -r 148376451559 test-forest --- a/test-forest Mon Aug 27 13:50:49 2007 -0400 +++ b/test-forest Mon Aug 27 13:51:50 2007 -0400 @@ -98,11 +98,21 @@ hg fpull -R topcopy -u 2>&1 \ | sed "s@\(/private\)*$HGTMP@HGTMP@g" -echo "# fpush" +echo "# foutgoing" echo "t/t/f" > topcopy/t/t/f hg commit --cwd topcopy/t/t -m "delete new line" -d "0 0" hg remove --cwd topcopy/d/d f2 hg commit -R topcopy -m "remove new file" -d "0 0" +hg foutgoing -R topcopy 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g" +hg foutgoing --cwd topcopy default 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g" +hg foutgoing -R topcopy foo 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g" + +echo "# fincoming" +hg fincoming -R toplevel topcopy 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g" +hg fincoming --cwd toplevel ../topcopy 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g" +hg fincoming -R toplevel foo 2>&1 | sed "s@\(/private\)*$HGTMP@HGTMP@g" + +echo "# fpush" hg fpush -R topcopy top-snap default | sed "s@\(/private\)*$HGTMP@HGTMP@g" echo "# fseed and fpull, missing section" diff -r cb22e7675abc -r 148376451559 test-forest.out --- a/test-forest.out Mon Aug 27 13:50:49 2007 -0400 +++ b/test-forest.out Mon Aug 27 13:51:50 2007 -0400 @@ -384,6 +384,178 @@ added 2 changesets with 2 changes to 1 files 1 files updated, 0 files merged, 0 files removed, 0 files unresolved +# foutgoing +[.] +comparing with HGTMP/test-forest/toplevel +searching for changes +changeset: 2:ea42b6f87495 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: remove new file + + +[d/d/t] +comparing with HGTMP/test-forest/toplevel/d/d/t +searching for changes +no changes found + +[e/d] +comparing with HGTMP/test-forest/toplevel/e/d +searching for changes +no changes found + +[t] +comparing with HGTMP/test-forest/toplevel/t +searching for changes +no changes found + +[t/t] +comparing with HGTMP/test-forest/toplevel/t/t +searching for changes +changeset: 2:c4c5521ca497 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: delete new line + + +[.] +comparing with HGTMP/test-forest/toplevel +searching for changes +changeset: 2:ea42b6f87495 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: remove new file + + +[d/d/t] +comparing with HGTMP/test-forest/toplevel/d/d/t +searching for changes +no changes found + +[e/d] +comparing with HGTMP/test-forest/toplevel/e/d +searching for changes +no changes found + +[t] +comparing with HGTMP/test-forest/toplevel/t +searching for changes +no changes found + +[t/t] +comparing with HGTMP/test-forest/toplevel/t/t +searching for changes +changeset: 2:c4c5521ca497 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: delete new line + + +[.] +skipped: repository foo not found + +[d/d/t] +skipped: repository foo not found + +[e/d] +skipped: repository foo not found + +[t] +skipped: repository foo not found + +[t/t] +skipped: repository foo not found + +# fincoming +[.] +comparing with topcopy +searching for changes +changeset: 2:ea42b6f87495 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: remove new file + + +[d/d/t] +comparing with topcopy/d/d/t +searching for changes +no changes found + +[e/d] +comparing with topcopy/e/d +searching for changes +no changes found + +[t] +comparing with topcopy/t +searching for changes +no changes found + +[t/t] +comparing with topcopy/t/t +searching for changes +changeset: 2:c4c5521ca497 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: delete new line + + +[.] +comparing with ../topcopy +searching for changes +changeset: 2:ea42b6f87495 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: remove new file + + +[d/d/t] +comparing with ../topcopy/d/d/t +searching for changes +no changes found + +[e/d] +comparing with ../topcopy/e/d +searching for changes +no changes found + +[t] +comparing with ../topcopy/t +searching for changes +no changes found + +[t/t] +comparing with ../topcopy/t/t +searching for changes +changeset: 2:c4c5521ca497 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: delete new line + + +[.] +skipped: repository foo not found + +[d/d/t] +skipped: repository foo not found + +[e/d] +skipped: repository foo not found + +[t] +skipped: repository foo not found + +[t/t] +skipped: repository foo not found + # fpush [.] pushing to HGTMP/test-forest/toplevel