[PATCH 1 of 1 v2] subrepo: make update -C for svn and git subrepos clean the working directory

Erik Zielke ez at aragost.com
Wed Jan 19 03:25:51 CST 2011


On 18-01-2011 17:55, Eric Eisner wrote:
> On Tue, Jan 18, 2011 at 05:28, Erik Zielke <ez at aragost.com 
> <mailto:ez at aragost.com>> wrote:
>
>     # HG changeset patch
>     # User Erik Zielke <ez at aragost.com <mailto:ez at aragost.com>>
>     # Date 1295345793 -3600
>     # Node ID b383c2eef8c942bdefcc9f3f08988d68fa5fbdcd
>     # Parent  0190442fe5e2dd2745f6fe2d845bfcc7e999c83e
>     subrepo: make update -C for svn and git subrepos clean the working
>     directory
>
>                 return
>             branch2rev, rev2branch = self._gitbranchmap()
>
>     +        def checkout(args):
>     +            cmd = ['checkout']
>     +            if overwrite:
>     +                self._gitcommand(['reset', 'HEAD', '.'])
>     +                cmd.append('-f')
>     +            self._gitcommand(cmd + args)
>     +
>             def rawcheckout():
>                 # no branch to checkout, check it out with no branch
>
>
>  There doesn't seem to be any reason to do this reset right before 
> running checkout with -f. It seems redundant and the tests pass 
> without it.
>

The test is wrong. The added file will as far as I can see be deleted by 
git checkout -f, and not just untracked, which is the reason why I run 
git reset HEAD . first. And the same problem occurs in the if overwrite 
above:

         elif self._gitstate() == revision:
             if overwrite:
                 self._gitcommand(['reset', '--hard', 'HEAD'])
             return

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110119/2944fcc6/attachment.htm>


More information about the Mercurial-devel mailing list