--- a/README Fri May 13 12:44:11 2005 -0800
+++ b/README Fri May 13 13:12:32 2005 -0800
@@ -37,6 +37,7 @@
$ hg add foo # add a new file for the next commit
$ hg remove bar # mark a file as removed
$ hg verify # check repo integrity
+ $ hg tags # show current tags
Branching and merging:
@@ -93,7 +94,6 @@
# merge changes from a remote machine
bar$ hg merge hg://foo/~user/hg-linux
-
Another approach which does perform well right now is to use rsync.
Simply rsync the remote repo to a read-only local copy and then do a
local pull.
--- a/hg Fri May 13 12:44:11 2005 -0800
+++ b/hg Fri May 13 13:12:32 2005 -0800
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
# mercurial - a minimal scalable distributed SCM
-# v0.4e "sabina"
+# v0.4f "jane dark"
#
# Copyright 2005 Matt Mackall <mpm@selenic.com>
#
@@ -37,6 +37,7 @@
dump <file> [rev] dump the latest or given revision of a file
dumpmanifest [rev] dump the latest or given revision of the manifest
diff [files...] diff working directory (or selected files)
+ tags show current changeset tags
"""
def filterfiles(list, files):
@@ -118,7 +119,7 @@
if cmd == "checkout" or cmd == "co":
node = repo.changelog.tip()
if args:
- node = repo.changelog.lookup(args[0])
+ node = repo.lookup(args[0])
repo.checkout(node)
elif cmd == "add":
@@ -177,7 +178,7 @@
opts = [('r', 'revision', [], 'revision')]
args = fancyopts.fancyopts(args, opts, doptions,
'hg diff [options] [files]')
- revs = map(lambda x: repo.changelog.lookup(x), doptions['revision'])
+ revs = map(lambda x: repo.lookup(x), doptions['revision'])
if len(revs) > 2:
print "too many revisions to diff"
@@ -191,12 +192,12 @@
diff(args, *revs)
elif cmd == "export":
- node = repo.changelog.lookup(args[0])
+ node = repo.lookup(args[0])
prev = repo.changelog.parents(node)[0]
diff(None, prev, node)
elif cmd == "debugchangegroup":
- newer = repo.newer(map(repo.changelog.lookup, args))
+ newer = repo.newer(map(repo.lookup, args))
for chunk in repo.changegroup(newer):
sys.stdout.write(chunk)
@@ -288,6 +289,17 @@
else:
print "missing source repository"
+elif cmd == "tags":
+ repo.lookup(0) # prime the cache
+ i = repo.tags.items()
+ i.sort()
+ for k, n in i:
+ try:
+ r = repo.changelog.rev(n)
+ except KeyError:
+ r = "?"
+ print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n))
+
elif cmd == "debugoldmerge":
if args:
other = hg.repository(ui, args[0])
--- a/mercurial/hg.py Fri May 13 12:44:11 2005 -0800
+++ b/mercurial/hg.py Fri May 13 13:12:32 2005 -0800
@@ -258,6 +258,7 @@
self.manifest = manifest(self.opener)
self.changelog = changelog(self.opener)
self.ignorelist = None
+ self.tags = None
if not self.remote:
self.dircache = dircache(self.opener, ui)
@@ -274,7 +275,7 @@
if self.ignorelist is None:
self.ignorelist = []
try:
- l = open(os.path.join(self.root, ".hgignore")).readlines()
+ l = open(os.path.join(self.root, ".hgignore"))
for pat in l:
if pat != "\n":
self.ignorelist.append(re.compile(pat[:-1]))
@@ -283,6 +284,21 @@
if pat.search(f): return True
return False
+ def lookup(self, key):
+ if self.tags is None:
+ self.tags = {}
+ try:
+ fl = self.file(".hgtags")
+ for l in fl.revision(fl.tip()).splitlines():
+ if l:
+ n, k = l.split(" ")
+ self.tags[k] = bin(n)
+ except KeyError: pass
+ try:
+ return self.tags[key]
+ except KeyError:
+ return self.changelog.lookup(key)
+
def join(self, f):
return os.path.join(self.path, f)
--- a/mercurial/revlog.py Fri May 13 12:44:11 2005 -0800
+++ b/mercurial/revlog.py Fri May 13 13:12:32 2005 -0800
@@ -73,7 +73,7 @@
if id in hex(n):
c.append(n)
if len(c) > 1: raise KeyError("Ambiguous identifier")
- if len(c) < 1: raise KeyError
+ if len(c) < 1: raise KeyError("No match found")
return c[0]
return None
--- a/setup.py Fri May 13 12:44:11 2005 -0800
+++ b/setup.py Fri May 13 13:12:32 2005 -0800
@@ -8,7 +8,7 @@
from distutils.core import setup
setup(name='mercurial',
- version='0.4e',
+ version='0.4f',
author='Matt Mackall',
author_email='mpm@selenic.com',
url='http://selenic.com/mercurial',