merge: move merge state file path into a constant stable
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 25 Feb 2014 17:14:49 -0800
branchstable
changeset 20588 4c4cd64c754b
parent 20577 de48422df393
child 20589 31993cd23b11
merge: move merge state file path into a constant We are about to change the format. Having the file path in a single place make it easier to update the filename for the new version.
mercurial/merge.py
--- a/mercurial/merge.py	Thu Feb 27 22:56:42 2014 +0530
+++ b/mercurial/merge.py	Tue Feb 25 17:14:49 2014 -0800
@@ -13,6 +13,7 @@
 
 class mergestate(object):
     '''track 3-way merge state of individual files'''
+    statepath = "merge/state"
     def __init__(self, repo):
         self._repo = repo
         self._dirty = False
@@ -26,7 +27,7 @@
     def _read(self):
         self._state = {}
         try:
-            f = self._repo.opener("merge/state")
+            f = self._repo.opener(self.statepath)
             for i, l in enumerate(f):
                 if i == 0:
                     self._local = bin(l[:-1])
@@ -40,7 +41,7 @@
         self._dirty = False
     def commit(self):
         if self._dirty:
-            f = self._repo.opener("merge/state", "w")
+            f = self._repo.opener(self.statepath, "w")
             f.write(hex(self._local) + "\n")
             for d, v in self._state.iteritems():
                 f.write("\0".join([d] + v) + "\n")