Show More
@@ -32,19 +32,24 b' def relpath(repo, args):' | |||||
32 | return [ util.pconvert(os.path.normpath(os.path.join(p, x))) for x in args ] |
|
32 | return [ util.pconvert(os.path.normpath(os.path.join(p, x))) for x in args ] | |
33 | return args |
|
33 | return args | |
34 |
|
34 | |||
35 |
def dodiff(ui, repo |
|
35 | def dodiff(ui, repo, files = None, node1 = None, node2 = None): | |
36 | def date(c): |
|
36 | def date(c): | |
37 | return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) |
|
37 | return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) | |
38 |
|
38 | |||
|
39 | (c, a, d, u) = repo.changes(None, node1, files) | |||
|
40 | if files: | |||
|
41 | c, a, d = map(lambda x: filterfiles(files, x), (c, a, d)) | |||
|
42 | ||||
|
43 | if not c and not a and not d: | |||
|
44 | return | |||
|
45 | ||||
39 | if node2: |
|
46 | if node2: | |
40 | change = repo.changelog.read(node2) |
|
47 | change = repo.changelog.read(node2) | |
41 | mmap2 = repo.manifest.read(change[0]) |
|
48 | mmap2 = repo.manifest.read(change[0]) | |
42 | (c, a, d, u) = repo.changes(node1, node2) |
|
|||
43 | def read(f): return repo.file(f).read(mmap2[f]) |
|
49 | def read(f): return repo.file(f).read(mmap2[f]) | |
44 | date2 = date(change) |
|
50 | date2 = date(change) | |
45 | else: |
|
51 | else: | |
46 | date2 = time.asctime() |
|
52 | date2 = time.asctime() | |
47 | (c, a, d, u) = repo.changes(None, node1, path) |
|
|||
48 | if not node1: |
|
53 | if not node1: | |
49 | node1 = repo.dirstate.parents()[0] |
|
54 | node1 = repo.dirstate.parents()[0] | |
50 | def read(f): return repo.wfile(f).read() |
|
55 | def read(f): return repo.wfile(f).read() | |
@@ -59,9 +64,6 b' def dodiff(ui, repo, path, files = None,' | |||||
59 | mmap = repo.manifest.read(change[0]) |
|
64 | mmap = repo.manifest.read(change[0]) | |
60 | date1 = date(change) |
|
65 | date1 = date(change) | |
61 |
|
66 | |||
62 | if files: |
|
|||
63 | c, a, d = map(lambda x: filterfiles(files, x), (c, a, d)) |
|
|||
64 |
|
||||
65 | for f in c: |
|
67 | for f in c: | |
66 | to = None |
|
68 | to = None | |
67 | if f in mmap: |
|
69 | if f in mmap: | |
@@ -411,7 +413,7 b' def diff(ui, repo, *files, **opts):' | |||||
411 | else: |
|
413 | else: | |
412 | files = relpath(repo, [""]) |
|
414 | files = relpath(repo, [""]) | |
413 |
|
415 | |||
414 |
dodiff(ui, repo, |
|
416 | dodiff(ui, repo, files, *revs) | |
415 |
|
417 | |||
416 | def export(ui, repo, changeset): |
|
418 | def export(ui, repo, changeset): | |
417 | """dump the changeset header and diffs for a revision""" |
|
419 | """dump the changeset header and diffs for a revision""" | |
@@ -428,7 +430,7 b' def export(ui, repo, changeset):' | |||||
428 | print change[4].rstrip() |
|
430 | print change[4].rstrip() | |
429 |
|
431 | |||
430 |
|
432 | |||
431 |
dodiff(ui, repo |
|
433 | dodiff(ui, repo, None, prev, node) | |
432 |
|
434 | |||
433 | def forget(ui, repo, file, *files): |
|
435 | def forget(ui, repo, file, *files): | |
434 | """don't add the specified files on the next commit""" |
|
436 | """don't add the specified files on the next commit""" | |
@@ -645,7 +647,7 b' def status(ui, repo):' | |||||
645 | R = removed |
|
647 | R = removed | |
646 | ? = not tracked''' |
|
648 | ? = not tracked''' | |
647 |
|
649 | |||
648 |
(c, a, d, u) = repo.changes(None, None |
|
650 | (c, a, d, u) = repo.changes(None, None) | |
649 | (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u)) |
|
651 | (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u)) | |
650 |
|
652 | |||
651 | for f in c: print "C", f |
|
653 | for f in c: print "C", f |
@@ -306,6 +306,7 b' class dirstate:' | |||||
306 | # recursive generator of all files listed |
|
306 | # recursive generator of all files listed | |
307 | def walk(files): |
|
307 | def walk(files): | |
308 | for f in uniq(files): |
|
308 | for f in uniq(files): | |
|
309 | f = os.path.join(self.root, f) | |||
309 | if os.path.isdir(f): |
|
310 | if os.path.isdir(f): | |
310 | for dir, subdirs, fl in os.walk(f): |
|
311 | for dir, subdirs, fl in os.walk(f): | |
311 | d = dir[len(self.root) + 1:] |
|
312 | d = dir[len(self.root) + 1:] | |
@@ -691,7 +692,7 b' class localrepository:' | |||||
691 | self.dirstate.update(new, "n") |
|
692 | self.dirstate.update(new, "n") | |
692 | self.dirstate.forget(remove) |
|
693 | self.dirstate.forget(remove) | |
693 |
|
694 | |||
694 |
def changes(self, node1, node2, |
|
695 | def changes(self, node1, node2, files=None): | |
695 | # changed, added, deleted, unknown |
|
696 | # changed, added, deleted, unknown | |
696 | c, a, d, u, mf1 = [], [], [], [], None |
|
697 | c, a, d, u, mf1 = [], [], [], [], None | |
697 |
|
698 |
General Comments 0
You need to be logged in to leave comments.
Login now