Show More
@@ -37,6 +37,7 b' Mercurial commands:' | |||
|
37 | 37 | $ hg add foo # add a new file for the next commit |
|
38 | 38 | $ hg remove bar # mark a file as removed |
|
39 | 39 | $ hg verify # check repo integrity |
|
40 | $ hg tags # show current tags | |
|
40 | 41 | |
|
41 | 42 | Branching and merging: |
|
42 | 43 | |
@@ -93,7 +94,6 b' Network support:' | |||
|
93 | 94 | # merge changes from a remote machine |
|
94 | 95 | bar$ hg merge hg://foo/~user/hg-linux |
|
95 | 96 | |
|
96 | ||
|
97 | 97 | Another approach which does perform well right now is to use rsync. |
|
98 | 98 | Simply rsync the remote repo to a read-only local copy and then do a |
|
99 | 99 | local pull. |
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # |
|
3 | 3 | # mercurial - a minimal scalable distributed SCM |
|
4 | # v0.4e "sabina" | |
|
4 | # v0.4f "jane dark" | |
|
5 | 5 | # |
|
6 | 6 | # Copyright 2005 Matt Mackall <mpm@selenic.com> |
|
7 | 7 | # |
@@ -37,6 +37,7 b' def help():' | |||
|
37 | 37 | dump <file> [rev] dump the latest or given revision of a file |
|
38 | 38 | dumpmanifest [rev] dump the latest or given revision of the manifest |
|
39 | 39 | diff [files...] diff working directory (or selected files) |
|
40 | tags show current changeset tags | |
|
40 | 41 | """ |
|
41 | 42 | |
|
42 | 43 | def filterfiles(list, files): |
@@ -118,7 +119,7 b' else:' | |||
|
118 | 119 | if cmd == "checkout" or cmd == "co": |
|
119 | 120 | node = repo.changelog.tip() |
|
120 | 121 | if args: |
|
121 |
node = repo. |
|
|
122 | node = repo.lookup(args[0]) | |
|
122 | 123 | repo.checkout(node) |
|
123 | 124 | |
|
124 | 125 | elif cmd == "add": |
@@ -177,7 +178,7 b' elif cmd == "diff":' | |||
|
177 | 178 | opts = [('r', 'revision', [], 'revision')] |
|
178 | 179 | args = fancyopts.fancyopts(args, opts, doptions, |
|
179 | 180 | 'hg diff [options] [files]') |
|
180 |
revs = map(lambda x: repo. |
|
|
181 | revs = map(lambda x: repo.lookup(x), doptions['revision']) | |
|
181 | 182 | |
|
182 | 183 | if len(revs) > 2: |
|
183 | 184 | print "too many revisions to diff" |
@@ -191,12 +192,12 b' elif cmd == "diff":' | |||
|
191 | 192 | diff(args, *revs) |
|
192 | 193 | |
|
193 | 194 | elif cmd == "export": |
|
194 |
node = repo. |
|
|
195 | node = repo.lookup(args[0]) | |
|
195 | 196 | prev = repo.changelog.parents(node)[0] |
|
196 | 197 | diff(None, prev, node) |
|
197 | 198 | |
|
198 | 199 | elif cmd == "debugchangegroup": |
|
199 |
newer = repo.newer(map(repo. |
|
|
200 | newer = repo.newer(map(repo.lookup, args)) | |
|
200 | 201 | for chunk in repo.changegroup(newer): |
|
201 | 202 | sys.stdout.write(chunk) |
|
202 | 203 | |
@@ -288,6 +289,17 b' elif cmd == "merge":' | |||
|
288 | 289 | else: |
|
289 | 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 | 303 | elif cmd == "debugoldmerge": |
|
292 | 304 | if args: |
|
293 | 305 | other = hg.repository(ui, args[0]) |
@@ -258,6 +258,7 b' class localrepository:' | |||
|
258 | 258 | self.manifest = manifest(self.opener) |
|
259 | 259 | self.changelog = changelog(self.opener) |
|
260 | 260 | self.ignorelist = None |
|
261 | self.tags = None | |
|
261 | 262 | |
|
262 | 263 | if not self.remote: |
|
263 | 264 | self.dircache = dircache(self.opener, ui) |
@@ -274,7 +275,7 b' class localrepository:' | |||
|
274 | 275 | if self.ignorelist is None: |
|
275 | 276 | self.ignorelist = [] |
|
276 | 277 | try: |
|
277 |
l = open(os.path.join(self.root, ".hgignore")) |
|
|
278 | l = open(os.path.join(self.root, ".hgignore")) | |
|
278 | 279 | for pat in l: |
|
279 | 280 | if pat != "\n": |
|
280 | 281 | self.ignorelist.append(re.compile(pat[:-1])) |
@@ -283,6 +284,21 b' class localrepository:' | |||
|
283 | 284 | if pat.search(f): return True |
|
284 | 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 | 302 | def join(self, f): |
|
287 | 303 | return os.path.join(self.path, f) |
|
288 | 304 |
General Comments 0
You need to be logged in to leave comments.
Login now