##// END OF EJS Templates
Clean up argument passing for dodiff
mpm@selenic.com -
r1014:e37cd99f default
parent child Browse files
Show More
@@ -140,7 +140,8 b' def make_file(repo, r, pat, node=None,'
140 return open(make_filename(repo, r, pat, node, total, seqno, revwidth),
140 return open(make_filename(repo, r, pat, node, total, seqno, revwidth),
141 mode)
141 mode)
142
142
143 def dodiff(fp, ui, repo, files=None, node1=None, node2=None, match=util.always, changes=None):
143 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always,
144 changes=None):
144 def date(c):
145 def date(c):
145 return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
146 return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
146
147
@@ -647,6 +648,11 b' def diff(ui, repo, *pats, **opts):'
647 if opts['rev']:
648 if opts['rev']:
648 revs = map(lambda x: repo.lookup(x), opts['rev'])
649 revs = map(lambda x: repo.lookup(x), opts['rev'])
649
650
651 node1, node2 = None, None
652 if len(revs) > 0:
653 node1 = revs[0]
654 if len(revs) > 1:
655 node2 = revs[1]
650 if len(revs) > 2:
656 if len(revs) > 2:
651 raise util.Abort("too many revisions to diff")
657 raise util.Abort("too many revisions to diff")
652
658
@@ -656,7 +662,8 b' def diff(ui, repo, *pats, **opts):'
656 roots, match, results = makewalk(repo, pats, opts)
662 roots, match, results = makewalk(repo, pats, opts)
657 for src, abs, rel, exact in results:
663 for src, abs, rel, exact in results:
658 files.append(abs)
664 files.append(abs)
659 dodiff(sys.stdout, ui, repo, files, *revs, **{'match': match})
665
666 dodiff(sys.stdout, ui, repo, node1, node2, files, match=match)
660
667
661 def doexport(ui, repo, changeset, seqno, total, revwidth, opts):
668 def doexport(ui, repo, changeset, seqno, total, revwidth, opts):
662 node = repo.lookup(changeset)
669 node = repo.lookup(changeset)
@@ -678,7 +685,7 b' def doexport(ui, repo, changeset, seqno,'
678 fp.write(change[4].rstrip())
685 fp.write(change[4].rstrip())
679 fp.write("\n\n")
686 fp.write("\n\n")
680
687
681 dodiff(fp, ui, repo, None, prev, node)
688 dodiff(fp, ui, repo, prev, node)
682 if fp != sys.stdout: fp.close()
689 if fp != sys.stdout: fp.close()
683
690
684 def export(ui, repo, *changesets, **opts):
691 def export(ui, repo, *changesets, **opts):
@@ -861,7 +868,7 b' def log(ui, repo, f=None, **opts):'
861 i = filelog.linkrev(filenode)
868 i = filelog.linkrev(filenode)
862 changenode = repo.changelog.node(i)
869 changenode = repo.changelog.node(i)
863 prev, other = repo.changelog.parents(changenode)
870 prev, other = repo.changelog.parents(changenode)
864 dodiff(sys.stdout, ui, repo, files, prev, changenode)
871 dodiff(sys.stdout, ui, repo, prev, changenode, files)
865 ui.write("\n\n")
872 ui.write("\n\n")
866
873
867 def manifest(ui, repo, rev=None):
874 def manifest(ui, repo, rev=None):
General Comments 0
You need to be logged in to leave comments. Login now