[patch] mq: .hg/patches/status -> .hg/mqstatus

Hermann Lauer Hermann.Lauer at iwr.uni-heidelberg.de
Tue Aug 24 05:15:25 CDT 2010


Hello all,

appended is a primilary patch against 1.6.2 which moves 
.hg/patches/status to .hg/mqstatus.

Rationale is that with mq there are two nested repositories, and the
data of the (mq)status file belongs to the outer repository, as
the contained hashes are defined in terms of the outer repository
and has no meaning without the outer repo.

This allows linking of the patches directory into different
versions of a software or testing on multiple architectures with shared
filesystems, as discussed in 
http://thread.gmane.org/gmane.comp.version-control.mercurial.general/17688/focus=17696
which contained a 1.5 version patch.

Sounds the proposed move of the (mq)status file feasible ?

So far I found no problems while using mq with that patches, but I'm 
no expert with the inner workings of mercurial.

Thanks,
 greetings
  Hermann

-- 
Netzwerkadministration/Zentrale Dienste, Interdiziplinaeres 
Zentrum fuer wissenschaftliches Rechnen der Universitaet Heidelberg
IWR; INF 368; 69120 Heidelberg; Tel: (06221)54-8236 Fax: -5224
Email: Hermann.Lauer at iwr.uni-heidelberg.de
-------------- next part --------------
mqstatus patch, 1. Version

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -246,13 +246,15 @@
         except IOError:
             curpath = os.path.join(path, 'patches')
         self.path = patchdir or curpath
+        self.statpath = patchdir or path
         self.opener = util.opener(self.path)
+        self.statopener = util.opener(self.statpath)
         self.ui = ui
         self.applied_dirty = 0
         self.series_dirty = 0
         self.added = []
         self.series_path = "series"
-        self.status_path = "status"
+        self.status_path = "mqstatus"
         self.guards_path = "guards"
         self.active_guards = None
         self.guards_dirty = False
@@ -268,11 +270,11 @@
 
     @util.propertycache
     def applied(self):
-        if os.path.exists(self.join(self.status_path)):
+        if os.path.exists(os.path.join(self.statpath,self.status_path)):
             def parse(l):
                 n, name = l.split(':', 1)
                 return statusentry(bin(n), name)
-            lines = self.opener(self.status_path).read().splitlines()
+            lines = self.statopener(self.status_path).read().splitlines()
             return [parse(l) for l in lines]
         return []
 
@@ -470,8 +472,13 @@
             for i in items:
                 fp.write("%s\n" % i)
             fp.close()
+        def write_statlist(items, path):
+            fp = self.statopener(path, 'w')
+            for i in items:
+                fp.write("%s\n" % i)
+            fp.close()
         if self.applied_dirty:
-            write_list(map(str, self.applied), self.status_path)
+            write_statlist(map(str, self.applied), self.status_path)
         if self.series_dirty:
             write_list(self.full_series, self.series_path)
         if self.guards_dirty:


More information about the Mercurial-devel mailing list