Merge with upstream
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 30 Jun 2005 21:47:23 +0100
changeset 542 eda4c32c167a
parent 541 abaea35387a8 (current diff)
parent 535 fba26990604a (diff)
child 543 61ead26cb8f0
Merge with upstream -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Merge with upstream manifest hash: 78c3657547aa957be685a4d54462570eb4b5e181 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCxFpbW7P1GVgWeRoRAqWGAKCkLQPbZpdLCBWKD+pecMtTRiu9EACfbuz4 dtHuM/86dYZ6CRqQHohJVjk= =v+Vv -----END PGP SIGNATURE-----
TODO
mercurial/commands.py
mercurial/hg.py
mercurial/hgweb.py
mercurial/revlog.py
--- a/TODO	Thu Jun 30 07:16:05 2005 +0100
+++ b/TODO	Thu Jun 30 21:47:23 2005 +0100
@@ -8,6 +8,7 @@
 - export to git
 - Add standard files: ChangeLog? What else?
 - Code cleanup: apply http://python.org/peps/pep-0008.html
+- Replace all remaining print statements with appropriate ui function
 
 Core:
 - difflib creating/removing files (fixed except dates: should be epoch)
--- a/mercurial/commands.py	Thu Jun 30 07:16:05 2005 +0100
+++ b/mercurial/commands.py	Thu Jun 30 21:47:23 2005 +0100
@@ -232,6 +232,9 @@
             f = name.find('@')
             if f >= 0:
                 name = name[:f]
+            f = name.find('<')
+            if f >= 0:
+                name = name[f+1:]
             bcache[rev] = name
             return name
 
@@ -269,55 +272,59 @@
     """make a copy of an existing repository"""
     source = ui.expandpath(source)
 
-    success = False
+    if dest is None:
+        dest = os.path.basename(os.path.normpath(source))
 
-    if dest is None:
-        dest = os.path.basename(source)
-        if dest == source:
-            ui.warn('abort: source and destination are the same\n')
-            sys.exit(1)
+    if os.path.exists(dest):
+        ui.warn("abort: destination '%s' already exists\n" % dest)
+        return 1
 
-    os.mkdir(dest)
+    class dircleanup:
+        def __init__(self, dir):
+            self.dir = dir
+            os.mkdir(dir)
+        def close(self):
+            self.dir = None
+        def __del__(self):
+            if self.dir:
+                import shutil
+                shutil.rmtree(self.dir, True)
 
-    try:
-        link = 0
-        if not (source.startswith("http://") or
-                source.startswith("hg://") or
-                source.startswith("old-http://")):
-            d1 = os.stat(dest).st_dev
-            d2 = os.stat(source).st_dev
-            if d1 == d2: link = 1
+    d = dircleanup(dest)
 
-        if link:
-            ui.debug("copying by hardlink\n")
-            util.system("cp -al '%s'/.hg '%s'/.hg" % (source, dest))
-            try:
-                os.remove(os.path.join(dest, ".hg", "dirstate"))
-            except: pass
+    link = 0
+    if not (source.startswith("http://") or
+            source.startswith("hg://") or
+            source.startswith("old-http://")):
+        d1 = os.stat(dest).st_dev
+        d2 = os.stat(source).st_dev
+        if d1 == d2: link = 1
 
-            repo = hg.repository(ui, dest)
+    if link:
+        ui.note("copying by hardlink\n")
+        util.system("cp -al '%s'/.hg '%s'/.hg" % (source, dest))
+        try:
+            os.remove(os.path.join(dest, ".hg", "dirstate"))
+        except: pass
+
+        repo = hg.repository(ui, dest)
 
-        else:
-            repo = hg.repository(ui, dest, create=1)
-            other = hg.repository(ui, source)
-            fetch = repo.findincoming(other)
-            if fetch:
-                cg = other.changegroup(fetch)
-                repo.addchangegroup(cg)
+    else:
+        repo = hg.repository(ui, dest, create=1)
+        other = hg.repository(ui, source)
+        fetch = repo.findincoming(other)
+        if fetch:
+            cg = other.changegroup(fetch)
+            repo.addchangegroup(cg)
 
-        f = repo.opener("hgrc", "w")
-        f.write("[paths]\n")
-        f.write("default = %s\n" % source)
-
-        if not opts['noupdate']:
-            update(ui, repo)
+    f = repo.opener("hgrc", "w")
+    f.write("[paths]\n")
+    f.write("default = %s\n" % source)
 
-        success = True
+    if not opts['noupdate']:
+        update(ui, repo)
 
-    finally:
-        if not success:
-            import shutil
-            shutil.rmtree(dest, True)
+    d.close()
 
 def commit(ui, repo, *files, **opts):
     """commit the specified files or all outstanding changes"""
--- a/mercurial/hg.py	Thu Jun 30 07:16:05 2005 +0100
+++ b/mercurial/hg.py	Thu Jun 30 21:47:23 2005 +0100
@@ -1014,9 +1014,9 @@
             if not f: break
             self.ui.debug("adding %s revisions\n" % f)
             fl = self.file(f)
-            o = fl.tip()
+            o = fl.count()
             n = fl.addgroup(getgroup(), revmap, tr)
-            revisions += fl.rev(n) - fl.rev(o)
+            revisions += fl.count() - o
             files += 1
 
         self.ui.status(("modified %d files, added %d changesets" +
--- a/mercurial/hgweb.py	Thu Jun 30 07:16:05 2005 +0100
+++ b/mercurial/hgweb.py	Thu Jun 30 21:47:23 2005 +0100
@@ -43,7 +43,7 @@
     return text.replace('\n', '<br/>\n')
 
 def obfuscate(text):
-    return ''.join([ '&#%d' % ord(c) for c in text ])
+    return ''.join([ '&#%d;' % ord(c) for c in text ])
 
 def up(p):
     if p[0] != "/": p = "/" + p
@@ -432,6 +432,9 @@
                     f = name.find('@')
                     if f >= 0:
                         name = name[:f]
+                    f = name.find('<')
+                    if f >= 0:
+                        name = name[f+1:]
                     bcache[r] = name
 
                 if last != cnode:
--- a/mercurial/revlog.py	Thu Jun 30 07:16:05 2005 +0100
+++ b/mercurial/revlog.py	Thu Jun 30 21:47:23 2005 +0100
@@ -37,7 +37,10 @@
 def hash(text, p1, p2):
     l = [p1, p2]
     l.sort()
-    return sha.sha(l[0] + l[1] + text).digest()
+    s = sha.new(l[0])
+    s.update(l[1])
+    s.update(text)
+    return s.digest()
 
 nullid = "\0" * 20
 indexformat = ">4l20s20s20s"