summaryrefslogtreecommitdiffstats
path: root/repo
diff options
context:
space:
mode:
Diffstat (limited to 'repo')
-rwxr-xr-xrepo30
1 files changed, 15 insertions, 15 deletions
diff --git a/repo b/repo
index f540cbb3..32cd1782 100755
--- a/repo
+++ b/repo
@@ -538,19 +538,19 @@ def _Checkout(cwd, branch, rev, quiet):
538def _FindRepo(): 538def _FindRepo():
539 """Look for a repo installation, starting at the current directory. 539 """Look for a repo installation, starting at the current directory.
540 """ 540 """
541 dir = os.getcwd() 541 curdir = os.getcwd()
542 repo = None 542 repo = None
543 543
544 olddir = None 544 olddir = None
545 while dir != '/' \ 545 while curdir != '/' \
546 and dir != olddir \ 546 and curdir != olddir \
547 and not repo: 547 and not repo:
548 repo = os.path.join(dir, repodir, REPO_MAIN) 548 repo = os.path.join(curdir, repodir, REPO_MAIN)
549 if not os.path.isfile(repo): 549 if not os.path.isfile(repo):
550 repo = None 550 repo = None
551 olddir = dir 551 olddir = curdir
552 dir = os.path.dirname(dir) 552 curdir = os.path.dirname(curdir)
553 return (repo, os.path.join(dir, repodir)) 553 return (repo, os.path.join(curdir, repodir))
554 554
555 555
556class _Options: 556class _Options:
@@ -656,13 +656,13 @@ def _SetDefaultsTo(gitdir):
656 656
657 657
658def main(orig_args): 658def main(orig_args):
659 main, dir = _FindRepo() 659 repo_main, rel_repo_dir = _FindRepo()
660 cmd, opt, args = _ParseArguments(orig_args) 660 cmd, opt, args = _ParseArguments(orig_args)
661 661
662 wrapper_path = os.path.abspath(__file__) 662 wrapper_path = os.path.abspath(__file__)
663 my_main, my_git = _RunSelf(wrapper_path) 663 my_main, my_git = _RunSelf(wrapper_path)
664 664
665 if not main: 665 if not repo_main:
666 if opt.help: 666 if opt.help:
667 _Usage() 667 _Usage()
668 if cmd == 'help': 668 if cmd == 'help':
@@ -682,25 +682,25 @@ def main(orig_args):
682 os.rmdir(os.path.join(root, name)) 682 os.rmdir(os.path.join(root, name))
683 os.rmdir(repodir) 683 os.rmdir(repodir)
684 sys.exit(1) 684 sys.exit(1)
685 main, dir = _FindRepo() 685 repo_main, rel_repo_dir = _FindRepo()
686 else: 686 else:
687 _NoCommands(cmd) 687 _NoCommands(cmd)
688 688
689 if my_main: 689 if my_main:
690 main = my_main 690 repo_main = my_main
691 691
692 ver_str = '.'.join(map(lambda x: str(x), VERSION)) 692 ver_str = '.'.join(map(lambda x: str(x), VERSION))
693 me = [main, 693 me = [repo_main,
694 '--repo-dir=%s' % dir, 694 '--repo-dir=%s' % rel_repo_dir,
695 '--wrapper-version=%s' % ver_str, 695 '--wrapper-version=%s' % ver_str,
696 '--wrapper-path=%s' % wrapper_path, 696 '--wrapper-path=%s' % wrapper_path,
697 '--'] 697 '--']
698 me.extend(orig_args) 698 me.extend(orig_args)
699 me.extend(extra_args) 699 me.extend(extra_args)
700 try: 700 try:
701 os.execv(main, me) 701 os.execv(repo_main, me)
702 except OSError, e: 702 except OSError, e:
703 print >>sys.stderr, "fatal: unable to start %s" % main 703 print >>sys.stderr, "fatal: unable to start %s" % repo_main
704 print >>sys.stderr, "fatal: %s" % e 704 print >>sys.stderr, "fatal: %s" % e
705 sys.exit(148) 705 sys.exit(148)
706 706