hg
changeset 29 4d3a5dcb6972
parent 24 57a1eef79415
child 31 642058291e74
equal deleted inserted replaced
28:9f64ee817199 29:4d3a5dcb6972
   110         files = f.read().splitlines()
   110         files = f.read().splitlines()
   111         f.close()
   111         f.close()
   112         repo.commit(files)
   112         repo.commit(files)
   113 
   113 
   114 elif cmd == "status":
   114 elif cmd == "status":
   115     (c, a, d) = repo.diffdir(repo.root)
   115     (c, a, d) = repo.diffdir(repo.root, repo.current)
   116     for f in c: print "C", f
   116     for f in c: print "C", f
   117     for f in a: print "?", f
   117     for f in a: print "?", f
   118     for f in d: print "R", f
   118     for f in d: print "R", f
   119 
   119 
   120 elif cmd == "diff":
   120 elif cmd == "diff":
   121     mmap = {}
   121     mmap = {}
   122     if repo.current:
   122     if repo.current:
   123         change = repo.changelog.read(repo.current)
   123         change = repo.changelog.read(repo.current)
   124         mmap = repo.manifest.read(change[0])
   124         mmap = repo.manifest.read(change[0])
   125 
   125 
   126     (c, a, d) = repo.diffdir(repo.root)
   126     (c, a, d) = repo.diffdir(repo.root, repo.current)
   127 
   127 
   128     if args:
   128     if args:
   129         nc = [ x for x in c if x in args ]
   129         nc = [ x for x in c if x in args ]
   130         na = [ x for x in a if x in args ]
   130         na = [ x for x in a if x in args ]
   131         nd = [ x for x in d if x in args ]
   131         nd = [ x for x in d if x in args ]
   149         to = repo.file(f).read(mmap[f])
   149         to = repo.file(f).read(mmap[f])
   150         tn = ""
   150         tn = ""
   151         sys.stdout.write(mdiff.unidiff(to, tn, f))
   151         sys.stdout.write(mdiff.unidiff(to, tn, f))
   152 
   152 
   153 elif cmd == "addremove":
   153 elif cmd == "addremove":
   154     (c, a, d) = repo.diffdir(repo.root)
   154     (c, a, d) = repo.diffdir(repo.root, repo.current)
   155     repo.add(a)
   155     repo.add(a)
   156     repo.remove(d)
   156     repo.remove(d)
   157     
   157     
   158 elif cmd == "history":
   158 elif cmd == "history":
   159     for i in range(repo.changelog.count()):
   159     for i in range(repo.changelog.count()):