Update and missing file in subrepo - a bug?

Wagner Bruna wagner.bruna+mercurial at gmail.com
Thu Feb 23 13:57:22 UTC 2012


On 02/22/2012 11:46 PM, Greg Ward wrote:
> On 22 February 2012, Michał Sznajder said:
>>
>> This should be $ hg update -C I missed the most important part...
> 
> Same story. "hg update -C" does not restore missing files any more
> than "hg update" does. This is occasionally surprising to CVS users
> who are used to "cvs update -C", which both clobbers uncommitted
> changes *and* restores missing files.

Unlike a plain update, update -C/--clean *does* restore missing files. But it
seems its behavior wrt subrepositories is inconsistent:

$ cat .hgsub
s = s
$ hg st -S
A s/b
! s/a

$ hg up -qC .
$ hg st -S
? s/b

$ rm s/a
$ hg st -S
! s/a
? s/b

$ hg up -qC .
$ hg st -S
! s/a
? s/b

> The non-subrepo answer is "hg revert" to restore missing files.
> 
>>>> hg status --subrepos
>>>> ! subrepo/file
>>>>
>>>> IMHO this is wrong: file should be brought back. Should I file a bug?

Looks like a bug to me, yes.

Regards,
Wagner

>> hg help subrepos says that update "update restores the subrepos in the
>> state they were originally committed in target changeset."
> 
> Hmmm. Sounds like inaccurate docs. I'm not sure, but I suspect it
> would be better to say
> 
>   updates subrepos to the changesets recorded in the target
>   (containing) changeset.
> 
> I.e., uncommitted changes in a subrepo should be preserved by update
> in the containing repo, and that includes the usual rules for missing
> files.
> 
>         Greg




More information about the Mercurial mailing list