Commits

m...@selenic.com  committed 275278b

0.4d release

Fix linking of changeset revs when merging
----------------
Allow checkout by number or hash
Print files touched in changeset
Fix reporting of incorrect changelog rev links in verify
----------------
Delete journal on destruction even if there are no entries to replay.
----------------
Fix empty transaction destruction
----------------
Fix off-by-one truncation in transaction rollback.
----------------
Fix network pull of repo files with "%" in their base64 encoding.
----------------
Update version numbers

  • Participants
  • Parent commits 0e04b2c

Comments (0)

Files changed (5)

 #!/usr/bin/env python
 #
 # mercurial - a minimal scalable distributed SCM
-# v0.4c "oedipa maas"
+# v0.4d "oedipa maas"
 #
 # Copyright 2005 Matt Mackall <mpm@selenic.com>
 #
 
 if cmd == "checkout" or cmd == "co":
     node = repo.changelog.tip()
-    if len(args): rev = int(args[0])
+    if len(args):
+        if len(args[0]) < 40:
+            rev = int(args[0])
+            node = repo.changelog.node(rev)
+        else:
+            node = args[0]
     repo.checkout(node)
 
 elif cmd == "add":
         print "manifest: %4d:%s" % (repo.manifest.rev(changes[0]),
                                     hg.hex(changes[0]))
         print "user:", changes[1]
-        print "files:", len(changes[3])
+        print "files:", " ".join(changes[3])
         print "description:"
         print changes[4]
 
             if n not in filenodes[f]:
                 print "%s:%s not in manifests" % (f, hg.hex(n))
             if fl.linkrev(n) not in filelinkrevs[f]:
-                print "%s:%s points to unknown changeset %s" \
-                      % (f, hg.hex(n), hg.hex(fl.changeset(n)))
+                print "%s:%s points to unexpected changeset rev %d" \
+                      % (f, hg.hex(n), fl.linkrev(n))
             t = fl.read(n)
             (p1, p2) = fl.parents(n)
             if p1 not in nodes:

File mercurial/hg.py

 # of the GNU General Public License, incorporated herein by reference.
 
 import sys, struct, sha, socket, os, time, base64, re, urllib2, binascii
+import urllib
 from mercurial import byterange
 from mercurial.transaction import *
 from mercurial.revlog import *
 def opener(base):
     p = base
     def o(path, mode="r"):
+        if p[:7] == "http://":
+            f = os.path.join(p, urllib.quote(path))
+            return httprangereader(f)
+
         f = os.path.join(p, path)
-        if p[:7] == "http://":
-            return httprangereader(f)
 
         if mode != "r" and os.path.isfile(f):
             s = os.stat(f)
         tr = self.transaction()
         changed = {}
         new = {}
-        nextrev = seqrev = self.changelog.count()
+        seqrev = self.changelog.count()
+        # some magic to allow fiddling in nested scope
+        nextrev = [seqrev]
 
         # helpers for back-linking file revisions to local changeset
         # revisions so we can immediately get to changeset from annotate
         def accumulate(text):
-            n = nextrev
             # track which files are added in which changeset and the
             # corresponding _local_ changeset revision
             files = self.changelog.extract(text)[3]
             for f in files:
-                changed.setdefault(f, []).append(n)
-            n += 1
+                changed.setdefault(f, []).append(nextrev[0])
+            nextrev[0] += 1
 
         def seq(start):
             while 1:

File mercurial/revlog.py

     def revisions(self, list):
         # this can be optimized to do spans, etc
         # be stupid for now
-        for r in list:
-            yield self.revision(r)
+        for node in list:
+            yield self.revision(node)
 
     def diff(self, a, b):
         return mdiff.textdiff(a, b)
         self.nodemap[node] = n
         entry = struct.pack(indexformat, *e)
 
-        transaction.add(self.datafile, e[0])
+        transaction.add(self.datafile, e[0] - 1)
         self.opener(self.datafile, "a").write(data)
-        transaction.add(self.indexfile, n * len(entry))
+        transaction.add(self.indexfile, (n + 1) * len(entry) - 1)
         self.opener(self.indexfile, "a").write(entry)
 
         self.cache = (node, n, text)

File mercurial/transaction.py

 
     def __del__(self):
         if self.entries: self.abort()
+        try: os.unlink(self.journal)
+        except: pass
 
     def add(self, file, offset):
         self.entries.append((file, offset))
 
         self.entries = []
 
-        try:
-            os.unlink(self.journal)
-            self.file.close()
-        except: pass
-
         print "rollback completed"
         
     def recover(self):
 from distutils.core import setup
 
 setup(name='mercurial',
-            version='0.4c',
+            version='0.4d',
             author='Matt Mackall',
             author_email='mpm@selenic.com',
             url='http://selenic.com/mercurial',