changelog: ensure that nodecache is valid (issue3428) stable
authorBryan O'Sullivan <bryano@fb.com>
Fri, 11 May 2012 01:55:33 -0700
branchstable
changeset 16619 bc84a1aeaf5a
parent 16611 462dd183bd73
child 16620 e22d6b1dec1d
changelog: ensure that nodecache is valid (issue3428) This ensures that an out-of-process hook can see an incoming changegroup.
mercurial/changelog.py
tests/test-hook.t
--- a/mercurial/changelog.py	Tue May 08 23:59:39 2012 +0400
+++ b/mercurial/changelog.py	Fri May 11 01:55:33 2012 -0700
@@ -153,6 +153,7 @@
         r = revlog.revlog(self.opener, file)
         self.index = r.index
         self.nodemap = r.nodemap
+        self._nodecache = r._nodecache
         self._chunkcache = r._chunkcache
 
     def writepending(self):
--- a/tests/test-hook.t	Tue May 08 23:59:39 2012 +0400
+++ b/tests/test-hook.t	Fri May 11 01:55:33 2012 -0700
@@ -579,3 +579,30 @@
   $ hg tag -f foo
   ['a', 'foo', 'tip']
 
+new commits must be visible in pretxnchangegroup (issue3428)
+
+  $ cd ..
+  $ hg init to
+  $ echo '[hooks]' >> to/.hg/hgrc
+  $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc
+  $ echo a >> to/a
+  $ hg --cwd to ci -Ama
+  adding a
+  $ hg clone to from
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo aa >> from/a
+  $ hg --cwd from ci -mb
+  $ hg --cwd from push
+  pushing to $TESTTMP/to
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  changeset:   1:9836a07b9b9d
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     b
+