##// END OF EJS Templates
git -> hg conversion script...
git -> hg conversion script contrib/convert-repo changes: - do not print verbose output so that error messages are seen more easily - Output the date as integer and not as floating point number. - Do not require a ".git" subdirectory to work on, but use the GIT_DIR environment var to specify the git repository. Change is otherwise compatible to the current version and I have tested it by converting the kernel and several git respositories from kernel.org. (Btw, the udev test dir contains a /sys dir with entries which should not be normal dirs and not be normal files. ;-) Thanks again for mercurial, Florian La Roche --- a/contrib/convert-repo +++ b/contrib/convert-repo @@ -28,26 +28,18 @@ self.path = path def getheads(self): - h = file(self.path + "/.git/HEAD").read()[:-1] - return [h] + return [file(self.path + "/HEAD").read()[:-1]] def catfile(self, rev, type): if rev == "0" * 40: raise IOError() - path = os.getcwd() - os.chdir(self.path) - fh = os.popen("git-cat-file %s %s 2>/dev/null" % (type, rev)) - os.chdir(path) + fh = os.popen("GIT_DIR=%s git-cat-file %s %s 2>/dev/null" % (self.path, type, rev)) return fh.read() def getfile(self, name, rev): return self.catfile(rev, "blob") def getchanges(self, version): - path = os.getcwd() - os.chdir(self.path) - fh = os.popen("git-diff-tree --root -m -r %s" % (version)) - os.chdir(path) - + fh = os.popen("GIT_DIR=%s git-diff-tree --root -m -r %s" % (self.path, version)) changes = [] for l in fh: if "\t" not in l: continue @@ -83,9 +75,9 @@ def gettags(self): tags = {} - for f in os.listdir(self.path + "/.git/refs/tags"): + for f in os.listdir(self.path + "/refs/tags"): try: - h = file(self.path + "/.git/refs/tags/" + f).read().strip() + h = file(self.path + "/refs/tags/" + f).read().strip() tags[f] = h except: pass @@ -99,8 +91,7 @@ def getheads(self): h = self.repo.changelog.heads() - h = [ hg.hex(x) for x in h ] - return h + return [ hg.hex(x) for x in h ] def putfile(self, f, e, data): self.repo.wfile(f, "w").write(data) @@ -155,12 +146,12 @@ newlines.sort() if newlines != oldlines: - print "updating tags" + #print "updating tags" f = self.repo.wfile(".hgtags", "w") f.write("".join(newlines)) f.close() if not oldlines: self.repo.add([".hgtags"]) - date = "%s 0" % time.mktime(time.gmtime()) + date = "%s 0" % int(time.mktime(time.gmtime())) self.repo.rawcommit([".hgtags"], "update tags", "convert-repo", date, self.repo.changelog.tip(), hg.nullid) @@ -262,7 +253,7 @@ num -= 1 if c in self.map: continue desc = self.commitcache[c][3].splitlines()[0] - print num, desc + #print num, desc self.copy(c) tags = self.source.gettags() @@ -275,6 +266,8 @@ self.dest.puttags(ctags) gitpath, hgpath, mapfile = sys.argv[1:] +if os.path.isdir(gitpath + "/.git"): + gitpath += "/.git" c = convert(convert_git(gitpath), convert_mercurial(hgpath), mapfile) c.convert() _______________________________________________ Mercurial mailing list Mercurial@selenic.com http://selenic.com/mailman/listinfo/mercurial

File last commit:

r1288:9a625fbf default
r1335:bea6356b default
Show More
ReadMe.html
123 lines | 4.2 KiB | text/html | HtmlLexer
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Mercurial for Windows</title>
</head>
<body>
<h1>Mercurial version 0.7 for Windows</h1>
<p>Welcome to Mercurial for Windows!</p>
<p>Mercurial is a command-line application. You must run it from
the Windows command prompt (or if you're hard core, a <a
href="http://www.mingw.org/">MinGW</a> shell).</p>
<p>For documentation, please visit the <a
href="http://www.selenic.com/mercurial">Mercurial web
site</a>.</p>
<p>By default, Mercurial installs to <tt>C:\Mercurial</tt>. The
Mercurial command is called <tt>hg.exe</tt>. To run this
command, the install directory must be in your search path.</p>
<h2>Setting your search path temporarily</h2>
<p>To set your search path temporarily, type the following into a
command prompt window:</p>
<pre>
set PATH=C:\Mercurial;%PATH%
</pre>
<h2>Setting your search path permanently</h2>
<p>To set your search path permanently, perform the following
steps. These instructions are for Windows NT, 2000 and XP.</p>
<ol>
<li>Open the Control Panel. Under Windows XP, select the
"Classic View".</li>
<li>Double-click on the "System" control panel.</li>
<li>Click on the "Advanced" tab.</li>
<li>Click on "Environment Variables". You'll find this near the
bottom of the window.</li>
<li>Under "System variables", you will see "Path". Double-click
it.</li>
<li>Edit "Variable value". Each path element is separated by a
semicolon (";") character. Append a semicolon to the end of the
list, followed by the path where you installed Mercurial
(e.g. <tt>C:\Mercurial</tt>).</li>
<li>Click on the various "OK" buttons until you've completely
exited from the System control panel.</li>
<li>Log out and log back in, or restart your system.</li>
<li>The next time you run the Windows command prompt, you will be
able to run the <tt>hg</tt> command without any special
help.</li>
</ol>
<h1>Testing Mercurial after you've installed it</h1>
<p>The easiest way to check that Mercurial is installed properly is to
just type the following at the command prompt:</p>
<pre>
hg
</pre>
<p>This command should print a useful help message. If it does,
other Mercurial commands should work fine for you.</p>
<h1>Reporting problems</h1>
<p>Before you report any problems, please consult the <a
href="http://www.selenic.com/mercurial">Mercurial web site</a> and
see if your question is already in our list of <a
href="http://www.selenic.com/mercurial/wiki/index.cgi/FAQ">Frequently
Answered Questions</a> (the "FAQ").
<p>If you cannot find an answer to your question, please feel
free to send mail to the Mercurial mailing list, at <a
href="mailto:mercurial@selenic.com">mercurial@selenic.com</a>.
<b>Remember</b>, the more useful information you include in your
report, the easier it will be for us to help you!</p>
<p>If you are IRC-savvy, that's usually the fastest way to get
help. Go to <tt>#mercurial</tt> on
<tt>irc.freenode.net</tt>.</p>
<h1>Author and copyright information</h1>
<p>Mercurial was written by <a href="http://www.selenic.com">Matt
Mackall</a>, and is maintained by Matt and a team of
volunteers.</p>
<p>The Windows installer was written by <a
href="http://www.serpentine.com/blog">Bryan
O'Sullivan</a>.</p>
<p>Mercurial is Copyright 2005 Matt Mackall and others. See the
<tt>Contributors.txt</tt> file for a list of contributors.</p>
<p>Mercurial is free software; you can redistribute it and/or
modify it under the terms of the <a
href="http://www.gnu.org/copyleft/gpl.html">GNU General Public
License</a> as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later
version.</p>
<p>Mercurial is distributed in the hope that it will be useful,
but <b>without any warranty</b>; without even the implied
warranty of <b>merchantability</b> or <b>fitness for a
particular purpose</b>. See the GNU General Public License for
more details.</p>
</body>
</html>