# HG changeset patch # User Alexis S. L. Carvalho # Date 2008-02-03 23:03:46 # Node ID ee317dbfb9d0b1247ab6f882e530a8d8dc320413 # Parent f2201aee3dc810f3b1b7af9093e336e3af0b85d2 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. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1900,6 +1900,10 @@ class localrepository(repo.repository): 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) diff --git a/tests/test-acl.out b/tests/test-acl.out --- a/tests/test-acl.out +++ b/tests/test-acl.out @@ -28,6 +28,7 @@ adding foo/Bar/file.txt revisions 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 @@ calling hook pretxnchangegroup.acl: hgex 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: acl.deny not enabled 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: acl.deny enabled, 0 entries for use 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: acl.deny enabled, 0 entries for use acl: allowing changeset ef1ea85a6374 acl: allowing changeset f9cafe1212c8 acl: allowing changeset 911600dab2ae +updating the branch cache rolling back last transaction 0:6675d58eff77 diff --git a/tests/test-newbranch b/tests/test-newbranch --- a/tests/test-newbranch +++ b/tests/test-newbranch @@ -41,6 +41,15 @@ echo corrupted > .hg/branch.cache 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 diff --git a/tests/test-newbranch.out b/tests/test-newbranch.out --- a/tests/test-newbranch.out +++ b/tests/test-newbranch.out @@ -83,6 +83,15 @@ 4909a3732169c0c20011c4f4b8fdff4e3d89b23f 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