Subrepo status/diff/revert

Martin Geisler mg at
Wed Aug 25 13:54:48 CDT 2010

Tim Henigan <tim.henigan at> writes:

> I created a repo on BitBucket for my "subrepo-revert" command [1]. It
> is currently implemented as an extension. Once I am satisfied with the
> design, I will look at wrapping the core revert command.
> If you have time to review, I would appreciate it. I will send it to
> the devel list for review once it is complete.

I looked at it and there are some small things you can do. First, you
should replace

  sub_hg = hg.repository(ui, path = subpath)


  ctx = repo['.'] # context for the working copy parent revision
  sub = ctx.sub(subpath) # subrepo for subpath

in order to create the right type of subrepository. We support both
Subversion and Mercurial subrepositories -- you will probably want to
test isinstance(sub, hgsubrepo) and act accordingly.

While your extension is definitely helpful, I'm planning something more
integrated, something that will allow me to do

  $ hg revert sub/a.txt

where the paths are crossing subrepository boundaries.

I've moved my patch repository here:

and here you can see what I'm currently experiementing with for status:

It is just a prototype, I still don't know how to best integrate this
with the rest of Mercurial.

Martin Geisler

Mercurial links:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the Mercurial-devel mailing list