something wrong with status command

Martin Geisler mg at lazybytes.net
Fri Nov 26 15:45:25 UTC 2010


Marco Giovannini <usernkey at gmail.com> writes:

> I think the file shouldn't be 'A' after a pull right ?
>
> C:\Documents and Settings\GiovannM\Desktop\cloned>hg status -S
>
> C:\Documents and Settings\GiovannM\Desktop\cloned>hg onsub "hg pull"
> pulling from c:\Documents and Settings\GiovannM\Desktop\main\../sub1
> searching for changes
> no changes found
> pulling from c:\Documents and Settings\GiovannM\Desktop\main\../sub1\../sub2
> searching for changes
> adding changesets
> adding manifests
> adding file changes
> added 1 changesets with 1 changes to 1 files
> (run 'hg update' to get a working copy)
>
> C:\Documents and Settings\GiovannM\Desktop\cloned>hg onsub "hg update"
> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>
> C:\Documents and Settings\GiovannM\Desktop\cloned>hg status -S
> A sub1\sub2\sub2_file01

The status is actually correct, but I understand why you are
surprised... let me try to explain.

You use the onsub extension from

  http://bitbucket.org/mg/onsub

For those who doesn't know: it just recursively executes the given
command inside each subrepo. Btw, it is not necessary to quote the
command for onsub, 'hg onsub hg pull' will also work.

You do a pull+update in the subrepo without updating the outer
repository. If we let '.' denote the first working copy parent revision
(as usual) and let '+' denote the working copy itself (the '+' is not
yet a supported notion in Mercurial), then the 'hg status -S' call is
expanded to:

  hg status --rev .:+

in the outer repository and to

  hg status --rev X:+

in the subrepo, where X is the revision mentioned in the .hgsubstate
file. This explains why the file shows up as added: you updated the
subrepo to reflect some revision Y, but the status command uses X as the
base revision.

I coded it like this in order for 'hg status -S' to work when the
.hgsubstate file *is* in sync with the subrepo revision. That is, after
you do 'hg update' in the outer repository and get Y into the
.hgsubstate file, then things will look normal again since the subrepo
status call will be

  hg status --rev Y:+

with Y == +.


All in all, the output shows you that you can updated the subrepo and
not yet committed the change to the outer repo, that is, the .hgsubstate
file will be updated if you commit.

-- 
Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20101126/a44eea83/attachment.asc>


More information about the Mercurial mailing list