contrib/hgit
changeset 720 095dd8c757e0
parent 719 dda258572847
child 737 8db4d406b3d3
child 740 d2422f10c136
equal deleted inserted replaced
719:dda258572847 720:095dd8c757e0
   109 
   109 
   110     while r:
   110     while r:
   111         if type != "commit":
   111         if type != "commit":
   112             sys.stderr.write("aborting hg cat-file only understands commits\n")
   112             sys.stderr.write("aborting hg cat-file only understands commits\n")
   113             sys.exit(1);
   113             sys.exit(1);
   114         n = repo.changelog.lookup(r)
   114         n = repo.lookup(r)
   115         catcommit(repo, n, prefix)
   115         catcommit(repo, n, prefix)
   116         if doptions['stdin']:
   116         if doptions['stdin']:
   117             try:
   117             try:
   118                 (type, r) = raw_input().split(' ');
   118                 (type, r) = raw_input().split(' ');
   119             except EOFError:
   119             except EOFError:
   144     count = 0
   144     count = 0
   145 
   145 
   146     # figure out which commits they are asking for and which ones they
   146     # figure out which commits they are asking for and which ones they
   147     # want us to stop on
   147     # want us to stop on
   148     for i in range(len(args)):
   148     for i in range(len(args)):
   149         if args[i].count('^'):
   149         if args[i].startswith('^'):
   150             s = args[i].split('^')[1]
   150             s = repo.lookup(args[i][1:])
   151             stop_sha1.append(repo.changelog.lookup(s))
   151             stop_sha1.append(s)
   152             want_sha1.append(s)
   152             want_sha1.append(s)
   153         elif args[i] != 'HEAD':
   153         elif args[i] != 'HEAD':
   154             want_sha1.append(args[i])
   154             want_sha1.append(repo.lookup(args[i]))
   155 
   155 
   156     # calculate the graph for the supplied commits
   156     # calculate the graph for the supplied commits
   157     for i in range(len(want_sha1)):
   157     for i in range(len(want_sha1)):
   158         reachable.append({});
   158         reachable.append({});
   159         n = repo.changelog.lookup(want_sha1[i]);
   159         n = want_sha1[i];
   160         visit = [n];
   160         visit = [n];
   161         reachable[i][n] = 1
   161         reachable[i][n] = 1
   162         while visit:
   162         while visit:
   163             n = visit.pop(0)
   163             n = visit.pop(0)
   164             if n in stop_sha1:
   164             if n in stop_sha1:
   222 def help():
   222 def help():
   223     sys.stderr.write("commands:\n")
   223     sys.stderr.write("commands:\n")
   224     sys.stderr.write("  hgit cat-file [type] sha1\n")
   224     sys.stderr.write("  hgit cat-file [type] sha1\n")
   225     sys.stderr.write("  hgit diff-tree [-p] [-r] sha1 sha1\n")
   225     sys.stderr.write("  hgit diff-tree [-p] [-r] sha1 sha1\n")
   226     sys.stderr.write("  hgit rev-tree [sha1 ... [^stop sha1]]\n")
   226     sys.stderr.write("  hgit rev-tree [sha1 ... [^stop sha1]]\n")
   227     sys.stderr.write("  hgit rev-list [-c]\n")
   227     sys.stderr.write("  hgit rev-list [-c] [sha1 [stop sha1]\n")
   228 
   228 
   229 cmd = sys.argv[1]
   229 cmd = sys.argv[1]
   230 args = sys.argv[2:]
   230 args = sys.argv[2:]
   231 u = ui.ui()
   231 u = ui.ui()
   232 signal.signal(signal.SIGTERM, catchterm)
   232 signal.signal(signal.SIGTERM, catchterm)