Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/extdiff.py @ 3098:fe9b13e35e46
Merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 15 Sep 2006 15:22:45 -0500 |
parents | eeaf9bcdfa25 |
children | 8e8deb8035a4 |
comparison
equal
deleted
inserted
replaced
3097:1b738357bba9 | 3098:fe9b13e35e46 |
---|---|
43 # pretty fast (at least faster than having to compare the entire tree). | 43 # pretty fast (at least faster than having to compare the entire tree). |
44 | 44 |
45 from mercurial.demandload import demandload | 45 from mercurial.demandload import demandload |
46 from mercurial.i18n import gettext as _ | 46 from mercurial.i18n import gettext as _ |
47 from mercurial.node import * | 47 from mercurial.node import * |
48 demandload(globals(), 'mercurial:commands,cmdutil,util os shutil tempfile') | 48 demandload(globals(), 'mercurial:cmdutil,util os shutil tempfile') |
49 | 49 |
50 def dodiff(ui, repo, diffcmd, diffopts, pats, opts): | 50 def dodiff(ui, repo, diffcmd, diffopts, pats, opts): |
51 def snapshot_node(files, node): | 51 def snapshot_node(files, node): |
52 '''snapshot files as of some revision''' | 52 '''snapshot files as of some revision''' |
53 changes = repo.changelog.read(node) | 53 changes = repo.changelog.read(node) |
88 fp = open(dest, 'w') | 88 fp = open(dest, 'w') |
89 for chunk in util.filechunkiter(repo.wopener(wfn)): | 89 for chunk in util.filechunkiter(repo.wopener(wfn)): |
90 fp.write(chunk) | 90 fp.write(chunk) |
91 return dirname | 91 return dirname |
92 | 92 |
93 node1, node2 = commands.revpair(ui, repo, opts['rev']) | 93 node1, node2 = cmdutil.revpair(ui, repo, opts['rev']) |
94 files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) | 94 files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) |
95 modified, added, removed, deleted, unknown = repo.status( | 95 modified, added, removed, deleted, unknown = repo.status( |
96 node1, node2, files, match=matchfn)[:5] | 96 node1, node2, files, match=matchfn)[:5] |
97 if not (modified or added or removed): | 97 if not (modified or added or removed): |
98 return 0 | 98 return 0 |
103 if node2: | 103 if node2: |
104 dir2 = snapshot_node(modified + added, node2) | 104 dir2 = snapshot_node(modified + added, node2) |
105 else: | 105 else: |
106 dir2 = snapshot_wdir(modified + added) | 106 dir2 = snapshot_wdir(modified + added) |
107 cmdline = ('%s %s %s %s' % | 107 cmdline = ('%s %s %s %s' % |
108 (util.shellquote(diffcmd), | 108 (util.shellquote(diffcmd), ' '.join(diffopts), |
109 ' '.join(map(util.shellquote, diffopts)), | |
110 util.shellquote(dir1), util.shellquote(dir2))) | 109 util.shellquote(dir1), util.shellquote(dir2))) |
111 ui.debug('running %r in %s\n' % (cmdline, tmproot)) | 110 ui.debug('running %r in %s\n' % (cmdline, tmproot)) |
112 util.system(cmdline, cwd=tmproot) | 111 util.system(cmdline, cwd=tmproot) |
113 return 1 | 112 return 1 |
114 finally: | 113 finally: |