Inconsistent HG_PENDING handling

Augie Fackler raf at durin42.com
Mon Feb 13 18:19:35 EST 2017


(+foozy, marmoute for transaction musing)

On Sun, Feb 12, 2017 at 07:06:49PM -0500, timeless wrote:
> bookmarks.py
>     if 'HG_PENDING' in encoding.environ:
>         try:
>             bkfile = repo.vfs('bookmarks.pending')
>
> dirstate.py
> def _trypending(root, vfs, filename):
>     '''Open  file to be read according to HG_PENDING environment variable
>
>     This opens '.pending' of specified 'filename' only when HG_PENDING
>     is equal to 'root'.
>
>     This returns '(fp, is_pending_opened)' tuple.
>     '''
>     if root == encoding.environ.get('HG_PENDING'):
>
> localrepo.py
>         if 'HG_PENDING' in encoding.environ:
>             p = encoding.environ['HG_PENDING']
>             if p.startswith(self.root):
>                 c.readpending('00changelog.i.a')
>
> it /seems/ like the dirstate code is designed so that it shows the
> dirstate for a given repository based on pending
> so, if i have a hg hook that deals w/ HG_PENDING
>
> and there are 2 hg things triggering pending
> and thus two repositories running hooks that deal w/ pending
> and for some reason one of them runs an hg command in the other repository
> that second repository will afaict not report the pending dirstate,
> since it checks carefully
> but will report the pending bookmark, since afaict it checks carelessly
>
> the same incorrect behavior appears to be present for phases too
>
> but that should mean a nested repo could see a pending something
>
> if i have a repo w/ a registered subrepo, and someone does a "push" to
> my repo, is the subrepo directory modified as part of the step leading
> to my push-pretxn hook?

This looks correct to me - there's one easy-to-fix bug in bookmarks,
and one hard-to-fix bug related to nested repositories. Can I at least
get you to draft a change for bookmarks to make it more sound?

Thanks!

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list