[Bug 4934] New: Presence of prechangegroup hook breaks pretxnclose hooks

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Wed Nov 4 00:34:26 UTC 2015


https://bz.mercurial-scm.org/show_bug.cgi?id=4934

            Bug ID: 4934
           Summary: Presence of prechangegroup hook breaks pretxnclose
                    hooks
           Product: Mercurial
           Version: default branch
          Hardware: PC
                OS: Mac OS
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at selenic.com
          Reporter: durham at fb.com
                CC: mercurial-devel at selenic.com

See the attached patch for a simple repro.

If a repo has a prechangegroup hook, it causes future pretxnclose hooks to run
without being able to see the changelog.a file, which means they cannot see the
new commits that are supposed to be tested in the hook.

The root cause is that changelog.delayupdate() must be called after every
changelog write, but in changegroup.py it is called *before* the changelog
writes. delayupdate() adds a subscription to the transaction that says "on the
next writepending() write to the .a file".  When prechangegroup is called, it
uses that subscription then throws the subscription away, so future hooks don't
execute it and consequently don't see the commits.

This bisects to "520defbc0335 hook: centralize passing HG_PENDING to external
hook process", but that change just exposes the issue (by making every hook
call tr.writepending()). The actual problem is from over a year ago (when
transaction writepending() was added), since it wasn't ensured that the
delayupdate subscription was added appropriately everywhere.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list