Inconsistent HG_PENDING handling

timeless timeless at gmail.com
Mon Feb 13 00:06:49 UTC 2017


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?


More information about the Mercurial-devel mailing list