Show More
@@ -2122,7 +2122,7 b' def diff(repo, node1=None, node2=None, m' | |||
|
2122 | 2122 | |
|
2123 | 2123 | def difffn(opts, losedata): |
|
2124 | 2124 | return trydiff(repo, revs, ctx1, ctx2, modified, added, removed, |
|
2125 | copy, getfilectx, opts, losedata, prefix) | |
|
2125 | copy, getfilectx, opts, losedata, prefix, '') | |
|
2126 | 2126 | if opts.upgrade and not opts.git: |
|
2127 | 2127 | try: |
|
2128 | 2128 | def losedata(fn): |
@@ -2230,13 +2230,16 b' def _filepairs(ctx1, modified, added, re' | |||
|
2230 | 2230 | yield f1, f2, copyop |
|
2231 | 2231 | |
|
2232 | 2232 | def trydiff(repo, revs, ctx1, ctx2, modified, added, removed, |
|
2233 | copy, getfilectx, opts, losedatafn, prefix): | |
|
2233 | copy, getfilectx, opts, losedatafn, prefix, relroot): | |
|
2234 | 2234 | '''given input data, generate a diff and yield it in blocks |
|
2235 | 2235 | |
|
2236 | 2236 | If generating a diff would lose data like flags or binary data and |
|
2237 | 2237 | losedatafn is not None, it will be called. |
|
2238 | 2238 | |
|
2239 |
prefix is added to every path in the diff output. |
|
|
2239 | relroot is removed and prefix is added to every path in the diff output. | |
|
2240 | ||
|
2241 | If relroot is not empty, this function expects every path in modified, | |
|
2242 | added, removed and copy to start with it.''' | |
|
2240 | 2243 | |
|
2241 | 2244 | def gitindex(text): |
|
2242 | 2245 | if not text: |
@@ -2261,6 +2264,13 b' def trydiff(repo, revs, ctx1, ctx2, modi' | |||
|
2261 | 2264 | |
|
2262 | 2265 | gitmode = {'l': '120000', 'x': '100755', '': '100644'} |
|
2263 | 2266 | |
|
2267 | if relroot != '' and (repo.ui.configbool('devel', 'all') | |
|
2268 | or repo.ui.configbool('devel', 'check-relroot')): | |
|
2269 | for f in modified + added + removed + copy.keys() + copy.values(): | |
|
2270 | if f is not None and not f.startswith(relroot): | |
|
2271 | raise AssertionError( | |
|
2272 | "file %s doesn't start with relroot %s" % (f, relroot)) | |
|
2273 | ||
|
2264 | 2274 | for f1, f2, copyop in _filepairs( |
|
2265 | 2275 | ctx1, modified, added, removed, copy, opts): |
|
2266 | 2276 | content1 = None |
@@ -2293,8 +2303,10 b' def trydiff(repo, revs, ctx1, ctx2, modi' | |||
|
2293 | 2303 | (f1 and f2 and flag1 != flag2)): |
|
2294 | 2304 | losedatafn(f2 or f1) |
|
2295 | 2305 | |
|
2296 |
path1 = |
|
|
2297 |
path2 = |
|
|
2306 | path1 = f1 or f2 | |
|
2307 | path2 = f2 or f1 | |
|
2308 | path1 = posixpath.join(prefix, path1[len(relroot):]) | |
|
2309 | path2 = posixpath.join(prefix, path2[len(relroot):]) | |
|
2298 | 2310 | header = [] |
|
2299 | 2311 | if opts.git: |
|
2300 | 2312 | header.append('diff --git %s%s %s%s' % |
General Comments 0
You need to be logged in to leave comments.
Login now