[PATCH] Fix the path problem on Windows that prevents to run hg from its own repository

Giuseppe Bilotta bilotta78 at hotpop.com
Fri Jul 1 11:17:18 CDT 2005


The attached patch solves the path problem that prevents to run hg
from its own repository. Under Windows, under normal circumstances,
the current path is searched before the site-lib path. Therefore, when
running a properly-installed hg from a repository containing a
directory named 'mercurial', hg will fail in various way. The solution
is to move the current path to the end of the module look-up path.
This is only done if the current path is present already.

(Patch inline and attached because I'm not sure attaching works
properly.)

----===***===---
diff -r f2442a6a5893 hg
--- a/hg	Fri Jul 01 08:10:52 2005
+++ b/hg	Fri Jul 01 17:55:29 2005
@@ -8,6 +8,12 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by
reference.
 
+import sys, os
+cwd = os.getcwd()
+if cwd in sys.path:
+  sys.path.remove(cwd)
+  sys.path.extend(cwd)
+
 from mercurial import commands
 
 commands.run()
----===***===---

-- 
Giuseppe "Oblomov" Bilotta

"Da grande lotterò per la pace"
"A me me la compra il mio babbo"
(Altan)
("When I grow up, I will fight for peace"
 "I'll have my daddy buy it for me")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hg-path.patch
Type: application/octet-string
Size: 423 bytes
Desc: Attached file: hg-path.patch
Url : http://www.selenic.com/pipermail/mercurial/attachments/20050701/9aab6c0a/hg-path.bin


More information about the Mercurial mailing list