Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 1058:402279974aea
Use ui.write instead of print in debugwalk.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 25 Aug 2005 10:11:54 -0700 |
parents | 2fd15d743b3b |
children | 4eab07ef66e2 |
comparison
equal
deleted
inserted
replaced
1057:2fd15d743b3b | 1058:402279974aea |
---|---|
714 ui.write("}\n") | 714 ui.write("}\n") |
715 | 715 |
716 def debugwalk(ui, repo, *pats, **opts): | 716 def debugwalk(ui, repo, *pats, **opts): |
717 items = list(walk(repo, pats, opts)) | 717 items = list(walk(repo, pats, opts)) |
718 if not items: return | 718 if not items: return |
719 fmt = '%%s %%-%ds %%-%ds %%s' % ( | 719 fmt = '%%s %%-%ds %%-%ds %%s\n' % ( |
720 max([len(abs) for (src, abs, rel, exact) in items]), | 720 max([len(abs) for (src, abs, rel, exact) in items]), |
721 max([len(rel) for (src, abs, rel, exact) in items])) | 721 max([len(rel) for (src, abs, rel, exact) in items])) |
722 exactly = {True: 'exact', False: ''} | 722 exactly = {True: 'exact', False: ''} |
723 for src, abs, rel, exact in items: | 723 for src, abs, rel, exact in items: |
724 print fmt % (src, abs, rel, exactly[exact]) | 724 ui.write(fmt % (src, abs, rel, exactly[exact])) |
725 | 725 |
726 def diff(ui, repo, *pats, **opts): | 726 def diff(ui, repo, *pats, **opts): |
727 """diff working directory (or selected files)""" | 727 """diff working directory (or selected files)""" |
728 node1, node2 = None, None | 728 node1, node2 = None, None |
729 revs = [repo.lookup(x) for x in opts['rev']] | 729 revs = [repo.lookup(x) for x in opts['rev']] |
804 if fn not in fcache: | 804 if fn not in fcache: |
805 fcache[fn] = repo.file(fn) | 805 fcache[fn] = repo.file(fn) |
806 return fcache[fn] | 806 return fcache[fn] |
807 | 807 |
808 def matchlines(body): | 808 def matchlines(body): |
809 # massively inefficient. rewrite. | |
809 for match in regexp.finditer(body): | 810 for match in regexp.finditer(body): |
810 start, end = match.span() | 811 start, end = match.span() |
811 lnum = body.count('\n', 0, start) + 1 | 812 lnum = body.count('\n', 0, start) + 1 |
812 lstart = body.rfind('\n', 0, start) + 1 | 813 lstart = body.rfind('\n', 0, start) + 1 |
813 lend = body.find('\n', end) | 814 lend = body.find('\n', end) |