hg
changeset 39 adf70fffca9f
parent 38 ed1d3e3ca8e0
child 46 93e868fa0db8
equal deleted inserted replaced
38:ed1d3e3ca8e0 39:adf70fffca9f
   110         print "Unable to open repository"
   110         print "Unable to open repository"
   111         sys.exit(0)
   111         sys.exit(0)
   112 
   112 
   113 if cmd == "checkout" or cmd == "co":
   113 if cmd == "checkout" or cmd == "co":
   114     node = repo.changelog.tip()
   114     node = repo.changelog.tip()
   115     if len(args):
   115     if args:
   116         if len(args[0]) < 40:
   116         node = repo.changelog.lookup(args[0])
   117             rev = int(args[0])
       
   118             node = repo.changelog.node(rev)
       
   119         else:
       
   120             node = args[0]
       
   121     repo.checkout(node)
   117     repo.checkout(node)
   122 
   118 
   123 elif cmd == "add":
   119 elif cmd == "add":
   124     repo.add(args)
   120     repo.add(args)
   125 
   121 
   148         pf = d + patch
   144         pf = d + patch
   149         os.system("patch -p%d < %s > /dev/null" % (strip, pf))
   145         os.system("patch -p%d < %s > /dev/null" % (strip, pf))
   150         f = os.popen("lsdiff --strip %d %s" % (strip, pf))
   146         f = os.popen("lsdiff --strip %d %s" % (strip, pf))
   151         files = f.read().splitlines()
   147         files = f.read().splitlines()
   152         f.close()
   148         f.close()
   153         repo.commit(files)
   149         repo.commit(repo.current, files)
   154 
   150 
   155 elif cmd == "status":
   151 elif cmd == "status":
   156     (c, a, d) = repo.diffdir(repo.root, repo.current)
   152     (c, a, d) = repo.diffdir(repo.root, repo.current)
   157     for f in c: print "C", f
   153     for f in c: print "C", f
   158     for f in a: print "?", f
   154     for f in a: print "?", f
   222 
   218 
   223 elif cmd == "dump":
   219 elif cmd == "dump":
   224     if args:
   220     if args:
   225         r = repo.file(args[0])
   221         r = repo.file(args[0])
   226         n = r.tip()
   222         n = r.tip()
   227         if len(args) > 1: n = hg.bin(args[1])
   223         if len(args) > 1: n = r.lookup(args[1])
   228         sys.stdout.write(r.read(n))
   224         sys.stdout.write(r.read(n))
   229     else:
   225     else:
   230         print "missing filename"
   226         print "missing filename"
   231 
   227 
   232 elif cmd == "dumpmanifest":
   228 elif cmd == "dumpmanifest":
   233     n = repo.manifest.tip()
   229     n = repo.manifest.tip()
   234     if len(args) > 0:
   230     if len(args) > 0:
   235         n = hg.bin(args[0])
   231         n = repo.manifest.lookup(args[0])
   236     m = repo.manifest.read(n)
   232     m = repo.manifest.read(n)
   237     files = m.keys()
   233     files = m.keys()
   238     files.sort()
   234     files.sort()
   239 
   235 
   240     for f in files:
   236     for f in files: