[PATCH 2/3] Permit directories ending in *.d or *.i

Goffredo Baroncelli kreijack at inwind.it
Thu Jul 14 16:40:52 CDT 2005


# HG changeset patch
# User kreijack at inwind.REMOVEME.it
# Node ID f72b48cab3bd9c8be58277af75066be69f1d5476
# Parent  7ba8a2d1e67ce5bebe38e425facc3ec1d9f6a22c
[PATCH 2/3] Permit directories ending in *.d or *.i

With this patches, mercurial stores the directories adding a '.dir' as postfix, so the
conflicts are avoided; this patch add the command repoupdate which update the repository from the
version 0 ( the actual one ) to the revision 1

diff -r 7ba8a2d1e67c -r f72b48cab3bd TODO
--- a/TODO      Thu Jul 14 21:31:05 2005
+++ b/TODO      Thu Jul 14 21:32:17 2005
@@ -10,7 +10,6 @@

 Core:
 - difflib creating/removing files (fixed except dates: should be epoch)
-- directory foo.d or foo.i with existing file foo (use some quoting?)
 - get various options from hgrc (e.g. history always -v, tip always -q)
 - better push support (hack exists)
 - hg over ssh:// and https:// and rsync://
diff -r 7ba8a2d1e67c -r f72b48cab3bd mercurial/commands.py
--- a/mercurial/commands.py     Thu Jul 14 21:31:05 2005
+++ b/mercurial/commands.py     Thu Jul 14 21:32:17 2005
@@ -796,6 +796,40 @@
 def remove(ui, repo, file, *files):
     """remove the specified files on the next commit"""
     repo.remove(relpath(repo, (file,) + files))
+
+def repoupgrade(ui,paths):
+    """upgrade the repository revision"""
+
+    def listdirs(path):
+        dirs = os.listdir(path)
+        res = []
+        for d in dirs:
+            dd =os.path.join(path, d)
+            if not os.path.isdir(dd):
+                continue
+
+            res = res + listdirs(dd)
+            res.append(dd)
+
+        return res
+
+    if not paths: paths=[os.getcwd(),]
+    for p in paths:
+        d = os.path.join(p, ".hg", "data")
+        if not os.path.isdir(d):
+            ui.warn("repository can't found in '%s'\n"%p)
+            continue
+
+        if os.path.isfile(os.path.join(p, ".hg", "version" )):
+            ui.warn("repository '%s' is not in revision 0\n"%p)
+            continue
+
+        for dname in listdirs(d):
+            os.rename( dname, dname + ".dir" )
+
+        f = open(os.path.join(p, ".hg", "version"), "w")
+        f.write("1\n")
+        f.close( )

 def revert(ui, repo, *names, **opts):
     """revert modified files or dirs back to their unmodified states"""
@@ -1106,6 +1140,7 @@
                   'hg rawcommit [options] [files]'),
     "recover": (recover, [], "hg recover"),
     "^remove|rm": (remove, [], "hg remove [files]"),
+    "^repoupgrade": (repoupgrade, [],"hg repoupgrade [rootdir]"),
     "^revert": (revert,
                [("n", "nonrecursive", None, "don't recurse into subdirs"),
                 ("r", "rev", "", "revision")],
@@ -1147,7 +1182,7 @@
               ('', 'version', None, 'output version information and exit'),
               ]

-norepo = "clone init version help debugindex debugindexdot"
+norepo = "clone init version help debugindex debugindexdot repoupgrade"

 def find(cmd):
     for e in table.keys():
-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack AT inwind.it>
Key fingerprint = CE3C 7E01 6782 30A3 5B87  87C0 BB86 505C 6B2A CFF9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.selenic.com/pipermail/mercurial/attachments/20050714/1572df7d/attachment.pgp


More information about the Mercurial mailing list