Show More
@@ -153,11 +153,6 b' def annotate(u, repo, file, *files, **op' | |||||
153 | for p,l in zip(zip(*pieces), lines): |
|
153 | for p,l in zip(zip(*pieces), lines): | |
154 | u.write(" ".join(p) + ": " + l[1]) |
|
154 | u.write(" ".join(p) + ": " + l[1]) | |
155 |
|
155 | |||
156 | def branch(ui, path): |
|
|||
157 | '''branch from a local repository''' |
|
|||
158 | # this should eventually support remote repos |
|
|||
159 | os.system("cp -al %s/.hg .hg" % path) |
|
|||
160 |
|
||||
161 | def cat(ui, repo, file, rev = []): |
|
156 | def cat(ui, repo, file, rev = []): | |
162 | """output the latest or given revision of a file""" |
|
157 | """output the latest or given revision of a file""" | |
163 | r = repo.file(relpath(repo, [file])[0]) |
|
158 | r = repo.file(relpath(repo, [file])[0]) | |
@@ -281,8 +276,31 b' def history(ui, repo):' | |||||
281 | print "description:" |
|
276 | print "description:" | |
282 | print changes[4] |
|
277 | print changes[4] | |
283 |
|
278 | |||
284 | def init(ui): |
|
279 | def init(ui, source=None): | |
285 | """create a repository""" |
|
280 | """create a new repository or copy an existing one""" | |
|
281 | ||||
|
282 | if source: | |||
|
283 | paths = {} | |||
|
284 | for name, path in ui.configitems("paths"): | |||
|
285 | paths[name] = path | |||
|
286 | ||||
|
287 | if source in paths: source = paths[source] | |||
|
288 | ||||
|
289 | link = 0 | |||
|
290 | if not source.startswith("http://"): | |||
|
291 | d1 = os.stat(os.getcwd()).st_dev | |||
|
292 | d2 = os.stat(source).st_dev | |||
|
293 | if d1 == d2: link = 1 | |||
|
294 | ||||
|
295 | if link: | |||
|
296 | ui.debug("copying by hardlink\n") | |||
|
297 | os.system("cp -al %s/.hg .hg" % source) | |||
|
298 | else: | |||
|
299 | repo = hg.repository(ui, ".", create=1) | |||
|
300 | other = hg.repository(ui, source) | |||
|
301 | cg = repo.getchangegroup(other) | |||
|
302 | repo.addchangegroup(cg) | |||
|
303 | else: | |||
286 | hg.repository(ui, ".", create=1) |
|
304 | hg.repository(ui, ".", create=1) | |
287 |
|
305 | |||
288 | def log(ui, repo, f): |
|
306 | def log(ui, repo, f): | |
@@ -484,7 +502,6 b' table = {' | |||||
484 | ('n', 'number', None, 'show revision number'), |
|
502 | ('n', 'number', None, 'show revision number'), | |
485 | ('c', 'changeset', None, 'show changeset')], |
|
503 | ('c', 'changeset', None, 'show changeset')], | |
486 | 'hg annotate [-u] [-c] [-n] [-r id] [files]'), |
|
504 | 'hg annotate [-u] [-c] [-n] [-r id] [files]'), | |
487 | "branch|clone": (branch, [], 'hg branch [path]'), |
|
|||
488 | "cat|dump": (cat, [], 'hg cat <file> [rev]'), |
|
505 | "cat|dump": (cat, [], 'hg cat <file> [rev]'), | |
489 | "commit|ci": (commit, |
|
506 | "commit|ci": (commit, | |
490 | [('t', 'text', "", 'commit text'), |
|
507 | [('t', 'text', "", 'commit text'), | |
@@ -501,7 +518,7 b' table = {' | |||||
501 | "heads": (heads, [], 'hg heads'), |
|
518 | "heads": (heads, [], 'hg heads'), | |
502 | "history": (history, [], 'hg history'), |
|
519 | "history": (history, [], 'hg history'), | |
503 | "help": (help, [], 'hg help [command]'), |
|
520 | "help": (help, [], 'hg help [command]'), | |
504 | "init": (init, [], 'hg init'), |
|
521 | "init": (init, [], 'hg init [url]'), | |
505 | "log": (log, [], 'hg log <file>'), |
|
522 | "log": (log, [], 'hg log <file>'), | |
506 | "manifest|dumpmanifest": (manifest, [], 'hg manifest [rev]'), |
|
523 | "manifest|dumpmanifest": (manifest, [], 'hg manifest [rev]'), | |
507 | "parents": (parents, [], 'hg parents [node]'), |
|
524 | "parents": (parents, [], 'hg parents [node]'), |
General Comments 0
You need to be logged in to leave comments.
Login now