update the branch cache at the end of addchangegroup
This should avoid a bad performance problem when the branch cache is
not up-to-date, and hgweb can't write an updated version because it
lacks permissions.
--- a/mercurial/localrepo.py Sun Feb 03 21:03:46 2008 -0200
+++ b/mercurial/localrepo.py Sun Feb 03 21:03:46 2008 -0200
@@ -1900,6 +1900,10 @@
del tr
if changesets > 0:
+ # forcefully update the on-disk branch cache
+ self.ui.debug(_("updating the branch cache\n"))
+ self.branchcache = None
+ self.branchtags()
self.hook("changegroup", node=hex(self.changelog.node(cor+1)),
source=srctype, url=url)
--- a/tests/test-acl.out Sun Feb 03 21:03:46 2008 -0200
+++ b/tests/test-acl.out Sun Feb 03 21:03:46 2008 -0200
@@ -28,6 +28,7 @@
adding foo/file.txt revisions
adding quux/file.py revisions
added 3 changesets with 3 changes to 3 files
+updating the branch cache
rolling back last transaction
0:6675d58eff77
@@ -59,6 +60,7 @@
acl: acl.allow not enabled
acl: acl.deny not enabled
acl: changes have source "push" - skipping
+updating the branch cache
rolling back last transaction
0:6675d58eff77
@@ -94,6 +96,7 @@
acl: allowing changeset ef1ea85a6374
acl: allowing changeset f9cafe1212c8
acl: allowing changeset 911600dab2ae
+updating the branch cache
rolling back last transaction
0:6675d58eff77
@@ -383,6 +386,7 @@
acl: allowing changeset ef1ea85a6374
acl: allowing changeset f9cafe1212c8
acl: allowing changeset 911600dab2ae
+updating the branch cache
rolling back last transaction
0:6675d58eff77
@@ -578,6 +582,7 @@
acl: allowing changeset ef1ea85a6374
acl: allowing changeset f9cafe1212c8
acl: allowing changeset 911600dab2ae
+updating the branch cache
rolling back last transaction
0:6675d58eff77
--- a/tests/test-newbranch Sun Feb 03 21:03:46 2008 -0200
+++ b/tests/test-newbranch Sun Feb 03 21:03:46 2008 -0200
@@ -41,6 +41,15 @@
hg log -qr foo
cat .hg/branch.cache
+echo % push should update the branch cache
+hg init ../target
+echo % pushing just rev 0
+hg push -qr 0 ../target
+cat ../target/.hg/branch.cache
+echo % pushing everything
+hg push -qf ../target
+cat ../target/.hg/branch.cache
+
echo % update with no arguments: tipmost revision of the current branch
hg up -q -C 0
hg up -q
--- a/tests/test-newbranch.out Sun Feb 03 21:03:46 2008 -0200
+++ b/tests/test-newbranch.out Sun Feb 03 21:03:46 2008 -0200
@@ -83,6 +83,15 @@
bf1bc2f45e834c75404d0ddab57d53beab56e2f8 default
4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo
67ec16bde7f1575d523313b9bca000f6a6f12dca bar
+% push should update the branch cache
+% pushing just rev 0
+be8523e69bf892e25817fc97187516b3c0804ae4 0
+be8523e69bf892e25817fc97187516b3c0804ae4 default
+% pushing everything
+4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4
+bf1bc2f45e834c75404d0ddab57d53beab56e2f8 default
+4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo
+67ec16bde7f1575d523313b9bca000f6a6f12dca bar
% update with no arguments: tipmost revision of the current branch
bf1bc2f45e83
4909a3732169 (foo) tip