onrepos: non-recursive traversal?

Greg Ward greg at gerg.ca
Wed Apr 20 20:09:49 CDT 2011


Hi Martin --

I'd like to propose a feature for the onrepos extension: non-recursive
traversal.

Use case: allextensions is my subrepo-based collection of all known
public Mercurial extensions.  I only maintain the top level, i.e. the
allextensions screen-scraping scripts and .hgsub*.  I have no
intention of making sweeping changes to all known Mercurial
extensions, which is why my .hgsub uses the existing public repos
rather than my own clones.

But if any of those extensions themselves use subrepos, then using
onrepos to update is going to bit me.  In fact, it did tonight: when I
ran

  hg onrepos 'hg pull --update'

it recursively pulled + updated the subrepo in hgopenurl.  I'm not
familiar with that extension and it's not my business to update its
dependencies.  And I certainly don't want to commit in there, because
I cannot push to its public URL.  So what I *really* want is

  hg onrepos --no-recurse 'hg pull --update'

which would give me the naive implementation of onrepos, i.e. just
iterate over the local .hgsub file.

Before I dive into implementing this, does it sound right to you?  Or
would you prefer a --max-depth option?  Or maybe --prune?

BTW, I've already implemented the test to specify what I want:

"""
--- a/test-onsub.t
+++ b/test-onsub.t
@@ -105,6 +105,12 @@
   a/y/s
   a/y/t

+Non-recursive traversal (depth 1):
+
+  $ hg onsub 'echo $HG_SUBPATH' --no-recurse
+  a
+  b
+
 Test aborting:

   $ hg onsub -v 'test $HG_SUBPATH != "a/y/r"'
"""

Simple eh?

Greg


More information about the Mercurial-devel mailing list