Show More
@@ -53,8 +53,8 from mercurial.node import * | |||||
53 | from mercurial import cmdutil, util |
|
53 | from mercurial import cmdutil, util | |
54 | import os, shutil, tempfile |
|
54 | import os, shutil, tempfile | |
55 |
|
55 | |||
56 | def dodiff(ui, repo, diffcmd, diffopts, pats, opts): |
|
56 | ||
57 |
|
|
57 | def snapshot_node(ui, repo, files, node, tmproot): | |
58 |
|
|
58 | '''snapshot files as of some revision''' | |
59 |
|
|
59 | mf = repo.changectx(node).manifest() | |
60 |
|
|
60 | dirname = os.path.basename(repo.root) | |
@@ -80,7 +80,8 def dodiff(ui, repo, diffcmd, diffopts, | |||||
80 |
|
|
80 | open(dest, 'wb').write(data) | |
81 |
|
|
81 | return dirname | |
82 |
|
82 | |||
83 | def snapshot_wdir(files): |
|
83 | ||
|
84 | def snapshot_wdir(ui, repo, files, tmproot): | |||
84 |
|
|
85 | '''snapshot files from working directory. | |
85 |
|
|
86 | if not using snapshot, -I/-X does not work and recursive diff | |
86 |
|
|
87 | in tools like kdiff3 and meld displays too many files.''' | |
@@ -104,6 +105,8 def dodiff(ui, repo, diffcmd, diffopts, | |||||
104 |
|
|
105 | fp.write(chunk) | |
105 |
|
|
106 | return dirname | |
106 |
|
107 | |||
|
108 | ||||
|
109 | def dodiff(ui, repo, diffcmd, diffopts, pats, opts): | |||
107 | node1, node2 = cmdutil.revpair(repo, opts['rev']) |
|
110 | node1, node2 = cmdutil.revpair(repo, opts['rev']) | |
108 | files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) |
|
111 | files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) | |
109 | modified, added, removed, deleted, unknown = repo.status( |
|
112 | modified, added, removed, deleted, unknown = repo.status( | |
@@ -113,11 +116,11 def dodiff(ui, repo, diffcmd, diffopts, | |||||
113 |
|
116 | |||
114 | tmproot = tempfile.mkdtemp(prefix='extdiff.') |
|
117 | tmproot = tempfile.mkdtemp(prefix='extdiff.') | |
115 | try: |
|
118 | try: | |
116 | dir1 = snapshot_node(modified + removed, node1) |
|
119 | dir1 = snapshot_node(ui, repo, modified + removed, node1, tmproot) | |
117 | if node2: |
|
120 | if node2: | |
118 | dir2 = snapshot_node(modified + added, node2) |
|
121 | dir2 = snapshot_node(ui, repo, modified + added, node2, tmproot) | |
119 | else: |
|
122 | else: | |
120 | dir2 = snapshot_wdir(modified + added) |
|
123 | dir2 = snapshot_wdir(ui, repo, modified + added, tmproot) | |
121 | cmdline = ('%s %s %s %s' % |
|
124 | cmdline = ('%s %s %s %s' % | |
122 | (util.shellquote(diffcmd), ' '.join(diffopts), |
|
125 | (util.shellquote(diffcmd), ' '.join(diffopts), | |
123 | util.shellquote(dir1), util.shellquote(dir2))) |
|
126 | util.shellquote(dir1), util.shellquote(dir2))) |
General Comments 0
You need to be logged in to leave comments.
Login now