##// END OF EJS Templates
Add tag support
mpm@selenic.com -
r67:a182f256 default
parent child Browse files
Show More
@@ -37,6 +37,7 b' Mercurial commands:'
37 $ hg add foo # add a new file for the next commit
37 $ hg add foo # add a new file for the next commit
38 $ hg remove bar # mark a file as removed
38 $ hg remove bar # mark a file as removed
39 $ hg verify # check repo integrity
39 $ hg verify # check repo integrity
40 $ hg tags # show current tags
40
41
41 Branching and merging:
42 Branching and merging:
42
43
@@ -93,7 +94,6 b' Network support:'
93 # merge changes from a remote machine
94 # merge changes from a remote machine
94 bar$ hg merge hg://foo/~user/hg-linux
95 bar$ hg merge hg://foo/~user/hg-linux
95
96
96
97 Another approach which does perform well right now is to use rsync.
97 Another approach which does perform well right now is to use rsync.
98 Simply rsync the remote repo to a read-only local copy and then do a
98 Simply rsync the remote repo to a read-only local copy and then do a
99 local pull.
99 local pull.
@@ -1,7 +1,7 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 #
2 #
3 # mercurial - a minimal scalable distributed SCM
3 # mercurial - a minimal scalable distributed SCM
4 # v0.4e "sabina"
4 # v0.4f "jane dark"
5 #
5 #
6 # Copyright 2005 Matt Mackall <mpm@selenic.com>
6 # Copyright 2005 Matt Mackall <mpm@selenic.com>
7 #
7 #
@@ -37,6 +37,7 b' def help():'
37 dump <file> [rev] dump the latest or given revision of a file
37 dump <file> [rev] dump the latest or given revision of a file
38 dumpmanifest [rev] dump the latest or given revision of the manifest
38 dumpmanifest [rev] dump the latest or given revision of the manifest
39 diff [files...] diff working directory (or selected files)
39 diff [files...] diff working directory (or selected files)
40 tags show current changeset tags
40 """
41 """
41
42
42 def filterfiles(list, files):
43 def filterfiles(list, files):
@@ -118,7 +119,7 b' else:'
118 if cmd == "checkout" or cmd == "co":
119 if cmd == "checkout" or cmd == "co":
119 node = repo.changelog.tip()
120 node = repo.changelog.tip()
120 if args:
121 if args:
121 node = repo.changelog.lookup(args[0])
122 node = repo.lookup(args[0])
122 repo.checkout(node)
123 repo.checkout(node)
123
124
124 elif cmd == "add":
125 elif cmd == "add":
@@ -177,7 +178,7 b' elif cmd == "diff":'
177 opts = [('r', 'revision', [], 'revision')]
178 opts = [('r', 'revision', [], 'revision')]
178 args = fancyopts.fancyopts(args, opts, doptions,
179 args = fancyopts.fancyopts(args, opts, doptions,
179 'hg diff [options] [files]')
180 'hg diff [options] [files]')
180 revs = map(lambda x: repo.changelog.lookup(x), doptions['revision'])
181 revs = map(lambda x: repo.lookup(x), doptions['revision'])
181
182
182 if len(revs) > 2:
183 if len(revs) > 2:
183 print "too many revisions to diff"
184 print "too many revisions to diff"
@@ -191,12 +192,12 b' elif cmd == "diff":'
191 diff(args, *revs)
192 diff(args, *revs)
192
193
193 elif cmd == "export":
194 elif cmd == "export":
194 node = repo.changelog.lookup(args[0])
195 node = repo.lookup(args[0])
195 prev = repo.changelog.parents(node)[0]
196 prev = repo.changelog.parents(node)[0]
196 diff(None, prev, node)
197 diff(None, prev, node)
197
198
198 elif cmd == "debugchangegroup":
199 elif cmd == "debugchangegroup":
199 newer = repo.newer(map(repo.changelog.lookup, args))
200 newer = repo.newer(map(repo.lookup, args))
200 for chunk in repo.changegroup(newer):
201 for chunk in repo.changegroup(newer):
201 sys.stdout.write(chunk)
202 sys.stdout.write(chunk)
202
203
@@ -288,6 +289,17 b' elif cmd == "merge":'
288 else:
289 else:
289 print "missing source repository"
290 print "missing source repository"
290
291
292 elif cmd == "tags":
293 repo.lookup(0) # prime the cache
294 i = repo.tags.items()
295 i.sort()
296 for k, n in i:
297 try:
298 r = repo.changelog.rev(n)
299 except KeyError:
300 r = "?"
301 print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n))
302
291 elif cmd == "debugoldmerge":
303 elif cmd == "debugoldmerge":
292 if args:
304 if args:
293 other = hg.repository(ui, args[0])
305 other = hg.repository(ui, args[0])
@@ -258,6 +258,7 b' class localrepository:'
258 self.manifest = manifest(self.opener)
258 self.manifest = manifest(self.opener)
259 self.changelog = changelog(self.opener)
259 self.changelog = changelog(self.opener)
260 self.ignorelist = None
260 self.ignorelist = None
261 self.tags = None
261
262
262 if not self.remote:
263 if not self.remote:
263 self.dircache = dircache(self.opener, ui)
264 self.dircache = dircache(self.opener, ui)
@@ -274,7 +275,7 b' class localrepository:'
274 if self.ignorelist is None:
275 if self.ignorelist is None:
275 self.ignorelist = []
276 self.ignorelist = []
276 try:
277 try:
277 l = open(os.path.join(self.root, ".hgignore")).readlines()
278 l = open(os.path.join(self.root, ".hgignore"))
278 for pat in l:
279 for pat in l:
279 if pat != "\n":
280 if pat != "\n":
280 self.ignorelist.append(re.compile(pat[:-1]))
281 self.ignorelist.append(re.compile(pat[:-1]))
@@ -283,6 +284,21 b' class localrepository:'
283 if pat.search(f): return True
284 if pat.search(f): return True
284 return False
285 return False
285
286
287 def lookup(self, key):
288 if self.tags is None:
289 self.tags = {}
290 try:
291 fl = self.file(".hgtags")
292 for l in fl.revision(fl.tip()).splitlines():
293 if l:
294 n, k = l.split(" ")
295 self.tags[k] = bin(n)
296 except KeyError: pass
297 try:
298 return self.tags[key]
299 except KeyError:
300 return self.changelog.lookup(key)
301
286 def join(self, f):
302 def join(self, f):
287 return os.path.join(self.path, f)
303 return os.path.join(self.path, f)
288
304
@@ -73,7 +73,7 b' class revlog:'
73 if id in hex(n):
73 if id in hex(n):
74 c.append(n)
74 c.append(n)
75 if len(c) > 1: raise KeyError("Ambiguous identifier")
75 if len(c) > 1: raise KeyError("Ambiguous identifier")
76 if len(c) < 1: raise KeyError
76 if len(c) < 1: raise KeyError("No match found")
77 return c[0]
77 return c[0]
78
78
79 return None
79 return None
@@ -8,7 +8,7 b''
8 from distutils.core import setup
8 from distutils.core import setup
9
9
10 setup(name='mercurial',
10 setup(name='mercurial',
11 version='0.4e',
11 version='0.4f',
12 author='Matt Mackall',
12 author='Matt Mackall',
13 author_email='mpm@selenic.com',
13 author_email='mpm@selenic.com',
14 url='http://selenic.com/mercurial',
14 url='http://selenic.com/mercurial',
General Comments 0
You need to be logged in to leave comments. Login now