[PATCH V2] mercurial: fixes update --clean to work on new branch (issue5003)

Piotr Listkiewicz piotr.listkiewicz at gmail.com
Mon Feb 29 03:10:51 EST 2016


>
> Not super enthousiastic about this behavior. Could we just not update
> anywhere in that situation? Without the abort, possibly with a message
> mentionning thate uncommited branch foo does not exist yet, so we are not
> updating anywhere.


I check this second time and i was wrong. Function
destutil._destupdatebranch must return non None revision number, or it will
be called second time in commands.update - in commands.update we have:

        if rev is None:
            updata = destutil.destupdate(repo, clean=clean, check=check)
            rev, movemarkfrom, brev = updata
            warndest = True

        repo.ui.setconfig('ui', 'forcemerge', tool, 'update')

        if clean:
            ret = hg.clean(repo, rev)
        else:
            ret = hg.update(repo, rev)

(link - https://selenic.com/hg/file/d2ac8b57a75d/mercurial/commands.py#l6989
)

Inside destutil.destupdate there is a  call to destutil._destupdatebranch
to calculate revision, but if we set revision to None function
destutil._destupdatebranch will be called inside hg.clean or hg.update.

Here, we could check if the branch exist in the repository at all and issue
> a special message if not.


 Yes, the message should be issued, but revision must be set (because
destutil._destupdatebranch must return not None revision due to the reason
i mentioned previously) so the question is if revision number for non
existing branch should be calculated by:

repo.revs('max(.::(head() and branch(%s)))'
                        , wc.p1().branch()).first()


2016-02-25 0:26 GMT+01:00 Pierre-Yves David <pierre-yves.david at ens-lyon.org>
:

>
>
> On 02/25/2016 12:17 AM, Piotr Listkiewicz wrote:
>
>>   Ok, i will change this behaviour in next patch
>>
>
> Make sure to work from the clowncopter. I've just pushed multiple foozy
> patch in the same code path.
>
> --
> Pierre-Yves David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160229/4c8f0f50/attachment.html>


More information about the Mercurial-devel mailing list