6 # This software may be used and distributed according to the terms |
6 # This software may be used and distributed according to the terms |
7 # of the GNU General Public License, incorporated herein by reference. |
7 # of the GNU General Public License, incorporated herein by reference. |
8 |
8 |
9 from i18n import _ |
9 from i18n import _ |
10 from node import hex, nullid, short |
10 from node import hex, nullid, short |
11 import base85, cmdutil, mdiff, util, context, revlog, diffhelpers, copies |
11 import base85, cmdutil, mdiff, util, revlog, diffhelpers, copies |
12 import cStringIO, email.Parser, os, popen2, re, errno |
12 import cStringIO, email.Parser, os, popen2, re, errno |
13 import sys, tempfile, zlib |
13 import sys, tempfile, zlib |
14 |
14 |
15 class PatchError(Exception): |
15 class PatchError(Exception): |
16 pass |
16 pass |
1178 flcache[f] = flctx._filelog |
1178 flcache[f] = flctx._filelog |
1179 return flctx |
1179 return flctx |
1180 |
1180 |
1181 # reading the data for node1 early allows it to play nicely |
1181 # reading the data for node1 early allows it to play nicely |
1182 # with repo.status and the revlog cache. |
1182 # with repo.status and the revlog cache. |
1183 ctx1 = context.changectx(repo, node1) |
1183 ctx1 = repo.changectx(node1) |
1184 # force manifest reading |
1184 # force manifest reading |
1185 man1 = ctx1.manifest() |
1185 man1 = ctx1.manifest() |
1186 date1 = util.datestr(ctx1.date()) |
1186 date1 = util.datestr(ctx1.date()) |
1187 |
1187 |
1188 if not changes: |
1188 if not changes: |
1191 |
1191 |
1192 if not modified and not added and not removed: |
1192 if not modified and not added and not removed: |
1193 return |
1193 return |
1194 |
1194 |
1195 if node2: |
1195 if node2: |
1196 ctx2 = context.changectx(repo, node2) |
1196 ctx2 = repo.changectx(node2) |
1197 execf2 = ctx2.manifest().execf |
1197 execf2 = ctx2.manifest().execf |
1198 linkf2 = ctx2.manifest().linkf |
1198 linkf2 = ctx2.manifest().linkf |
1199 else: |
1199 else: |
1200 ctx2 = context.workingctx(repo) |
1200 ctx2 = repo.workingctx() |
1201 execf2 = util.execfunc(repo.root, None) |
1201 execf2 = util.execfunc(repo.root, None) |
1202 linkf2 = util.linkfunc(repo.root, None) |
1202 linkf2 = util.linkfunc(repo.root, None) |
1203 if execf2 is None: |
1203 if execf2 is None: |
1204 mc = ctx2.parents()[0].manifest().copy() |
1204 mc = ctx2.parents()[0].manifest().copy() |
1205 execf2 = mc.execf |
1205 execf2 = mc.execf |