[PATCH] Re: [PATCH 0/3] Permit directories ending in *.d or *.i

Goffredo Baroncelli kreijack at aliceposta.it
Thu Jul 28 15:09:03 CDT 2005


On Thursday 28 July 2005 21:27, you (Kevin Smith) wrote:
> Goffredo Baroncelli wrote:
> > On Wednesday 27 July 2005 19:29, you (Matt Mackall) wrote:
> >>
> >>I think this handles all the cases and should do so without breaking
> >>existing repos.
> > 
> > No, if anyone has already an old repository with a directory named 'a.d', your scheme fails.
> 
> I agree that Matt's scheme would break existing repos. In addition to 
> your example, I believe it would also fail for existing repos that have 
> files and/or directories ending in .hg. We really will want to do some 
> kind of migration either way.
> 
> However, based on my (poor) memory of the earlier proposal, I think 
> Matt's proposal sounds simpler as a long-term solution. 

> I think its migration would be a easier, too, since many repos wouldn't 
> have to change at all.

In most case (99.9999%) the Matt's solution is easier; but because we should
provide in any case a migration tool ( for the 0.00001% ), I don't think 
that the number of case where the repository upgrade is needed matters.

If you saw my previous patches, the great part of code is related to the
upgrade of the repository;

In any cases  below there is an implementation of Matt's scheme WITHOUT the code 
for a repository upgrade ( not very well tested ).


diff -r 853bfbf1a312 mercurial/hg.py
--- a/mercurial/hg.py   Wed Jul 27 18:21:19 2005
+++ b/mercurial/hg.py   Thu Jul 28 22:00:23 2005
@@ -15,6 +15,17 @@

 class filelog(revlog):
     def __init__(self, opener, path):
+
+        (dirs,name)=os.path.split(path)
+        rdir=""
+        while dirs:
+            (tail,head) = os.path.split(dirs)
+            if head.endswith(".d") or head.endswith(".i") or head.endswith(".hg"):
+                head += ".hg"
+            rdir = os.path.join(head ,rdir )
+            dirs = tail
+
+        path = os.path.join(rdir,name)
         revlog.__init__(self, opener,
                         os.path.join("data", path + ".i"),
                         os.path.join("data", path + ".d"))


> Kevin
Goffredo

-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack AT inwind DOT 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/20050728/e8b607ae/attachment.pgp


More information about the Mercurial mailing list