[PATCH 2 of 2] requires: write requires file on commit

Drew Gottlieb drgott at google.com
Mon May 4 13:27:58 CDT 2015

# HG changeset patch
# User Drew Gottlieb <drgott at google.com>
# Date 1429641493 25200
#      Tue Apr 21 11:38:13 2015 -0700
# Node ID 85c369520dd97bad369a0c4b924597f9e720077b
# Parent  3f86e3b2548def52732e1f782e89297db8075e8b
requires: write requires file on commit

Writing the requires file on commit makes it possible for changes to a
repo's config to enable features that affect the repo's requirements. An
example of this would be enabling manifestv2 in the future, which would then
have future commits be written with the new manifest format, making it
necessary for the requires file to indicate this.

This change also modifies test-inherit-mode to expect the requires file's
mode to inherit from the store's mode after a commit. Previously, it only
inherited from the store's mode on repo init, and the test assumed it would
never be touched after this point.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1602,6 +1602,7 @@
                 # if minimal phase was 0 we don't need to retract anything
                 phases.retractboundary(self, tr, targetphase, [n])
+            self._writerequirements()
             return n
diff --git a/tests/test-inherit-mode.t b/tests/test-inherit-mode.t
--- a/tests/test-inherit-mode.t
+++ b/tests/test-inherit-mode.t
@@ -70,7 +70,7 @@
   00660 ./.hg/cache/rbc-revs-v1
   00660 ./.hg/dirstate
   00660 ./.hg/last-message.txt
-  00600 ./.hg/requires
+  00660 ./.hg/requires
   00770 ./.hg/store/
   00660 ./.hg/store/00changelog.i
   00660 ./.hg/store/00manifest.i

More information about the Mercurial-devel mailing list