Show More
@@ -234,7 +234,7 b' def annotate(u, repo, file, *files, **op' | |||
|
234 | 234 | name = name[:f] |
|
235 | 235 | bcache[rev] = name |
|
236 | 236 | return name |
|
237 | ||
|
237 | ||
|
238 | 238 | bcache = {} |
|
239 | 239 | opmap = [['user', getname], ['number', str], ['changeset', getnode]] |
|
240 | 240 | if not ops['user'] and not ops['changeset']: |
@@ -273,42 +273,53 b' def clone(ui, source, dest = None, **opt' | |||
|
273 | 273 | |
|
274 | 274 | if source in paths: source = paths[source] |
|
275 | 275 | |
|
276 | created = False | |
|
277 | ||
|
276 | 278 | if dest is None: |
|
277 | 279 | dest = os.getcwd() |
|
278 | 280 | elif not os.path.exists(dest): |
|
279 |
os.m |
|
|
281 | os.mkdir(dest) | |
|
282 | created = True | |
|
283 | ||
|
284 | try: | |
|
285 | dest = os.path.realpath(dest) | |
|
280 | 286 | |
|
281 | link = 0 | |
|
282 | if not source.startswith("http://"): | |
|
283 | source = os.path.realpath(source) | |
|
284 | d1 = os.stat(dest).st_dev | |
|
285 | d2 = os.stat(source).st_dev | |
|
286 | if d1 == d2: link = 1 | |
|
287 | link = 0 | |
|
288 | if not source.startswith("http://"): | |
|
289 | source = os.path.realpath(source) | |
|
290 | d1 = os.stat(dest).st_dev | |
|
291 | d2 = os.stat(source).st_dev | |
|
292 | if d1 == d2: link = 1 | |
|
287 | 293 | |
|
288 | os.chdir(dest) | |
|
294 | os.chdir(dest) | |
|
289 | 295 | |
|
290 | if link: | |
|
291 | ui.debug("copying by hardlink\n") | |
|
292 | os.system("cp -al %s/.hg .hg" % source) | |
|
293 | try: | |
|
294 | os.remove(".hg/dirstate") | |
|
295 | except: pass | |
|
296 | if link: | |
|
297 | ui.debug("copying by hardlink\n") | |
|
298 | os.system("cp -al %s/.hg .hg" % source) | |
|
299 | try: | |
|
300 | os.remove(".hg/dirstate") | |
|
301 | except: pass | |
|
296 | 302 | |
|
297 | repo = hg.repository(ui, ".") | |
|
303 | repo = hg.repository(ui, ".") | |
|
298 | 304 | |
|
299 | else: | |
|
300 | repo = hg.repository(ui, ".", create=1) | |
|
301 | other = hg.repository(ui, source) | |
|
302 | cg = repo.getchangegroup(other) | |
|
303 | repo.addchangegroup(cg) | |
|
305 | else: | |
|
306 | repo = hg.repository(ui, ".", create=1) | |
|
307 | other = hg.repository(ui, source) | |
|
308 | cg = repo.getchangegroup(other) | |
|
309 | repo.addchangegroup(cg) | |
|
304 | 310 | |
|
305 | f = repo.opener("hgrc", "w") | |
|
306 | f.write("[paths]\n") | |
|
307 | f.write("default = %s\n" % source) | |
|
311 | f = repo.opener("hgrc", "w") | |
|
312 | f.write("[paths]\n") | |
|
313 | f.write("default = %s\n" % source) | |
|
308 | 314 | |
|
309 | if not opts['no-update']: | |
|
310 | update(ui, repo) | |
|
311 | ||
|
315 | if not opts['no-update']: | |
|
316 | update(ui, repo) | |
|
317 | except: | |
|
318 | if created: | |
|
319 | import shutil | |
|
320 | shutil.rmtree(dest, True) | |
|
321 | raise | |
|
322 | ||
|
312 | 323 | def commit(ui, repo, *files, **opts): |
|
313 | 324 | """commit the specified files or all outstanding changes""" |
|
314 | 325 | text = opts['text'] |
@@ -459,7 +470,7 b' def import_(ui, repo, patch1, *patches, ' | |||
|
459 | 470 | pass |
|
460 | 471 | |
|
461 | 472 | patches = (patch1,) + patches |
|
462 | ||
|
473 | ||
|
463 | 474 | d = opts["base"] |
|
464 | 475 | strip = opts["strip"] |
|
465 | 476 | |
@@ -543,7 +554,7 b' def pull(ui, repo, source="default", **o' | |||
|
543 | 554 | source = paths[source] |
|
544 | 555 | |
|
545 | 556 | ui.status('pulling from %s\n' % (source)) |
|
546 | ||
|
557 | ||
|
547 | 558 | other = hg.repository(ui, source) |
|
548 | 559 | cg = repo.getchangegroup(other) |
|
549 | 560 | r = repo.addchangegroup(cg) |
@@ -562,7 +573,7 b' def push(ui, repo, dest="default-push"):' | |||
|
562 | 573 | paths[name] = path |
|
563 | 574 | |
|
564 | 575 | if dest in paths: dest = paths[dest] |
|
565 | ||
|
576 | ||
|
566 | 577 | if not dest.startswith("ssh://"): |
|
567 | 578 | ui.warn("abort: can only push to ssh:// destinations currently\n") |
|
568 | 579 | return 1 |
@@ -607,9 +618,9 b' def rawcommit(ui, repo, *flist, **rc):' | |||
|
607 | 618 | files += open(rc['files']).read().splitlines() |
|
608 | 619 | |
|
609 | 620 | rc['parent'] = map(repo.lookup, rc['parent']) |
|
610 | ||
|
621 | ||
|
611 | 622 | repo.rawcommit(files, text, rc['user'], rc['date'], *rc['parent']) |
|
612 | ||
|
623 | ||
|
613 | 624 | def recover(ui, repo): |
|
614 | 625 | """roll back an interrupted transaction""" |
|
615 | 626 | repo.recover() |
@@ -626,7 +637,7 b' def serve(ui, repo, **opts):' | |||
|
626 | 637 | """export the repository via HTTP""" |
|
627 | 638 | hgweb.server(repo.root, opts["name"], opts["templates"], |
|
628 | 639 | opts["address"], opts["port"]) |
|
629 | ||
|
640 | ||
|
630 | 641 | def status(ui, repo): |
|
631 | 642 | '''show changed files in the working directory |
|
632 | 643 | |
@@ -645,7 +656,7 b' def status(ui, repo):' | |||
|
645 | 656 | |
|
646 | 657 | def tag(ui, repo, name, rev = None, **opts): |
|
647 | 658 | """add a tag for the current tip or a given revision""" |
|
648 | ||
|
659 | ||
|
649 | 660 | if name == "tip": |
|
650 | 661 | ui.warn("abort: 'tip' is a reserved name!\n") |
|
651 | 662 | return -1 |
@@ -755,7 +766,7 b' table = {' | |||
|
755 | 766 | "log": (log, [], 'hg log <file>'), |
|
756 | 767 | "manifest": (manifest, [], 'hg manifest [rev]'), |
|
757 | 768 | "parents": (parents, [], 'hg parents [node]'), |
|
758 |
"pull": (pull, |
|
|
769 | "pull": (pull, | |
|
759 | 770 | [('u', 'update', None, 'update working directory')], |
|
760 | 771 | 'hg pull [options] [source]'), |
|
761 | 772 | "push": (push, [], 'hg push <destination>'), |
General Comments 0
You need to be logged in to leave comments.
Login now