##// END OF EJS Templates
patch: use opt.showsimilarity to calculate and show the similarity...
Sean Farley -
r30807:6381a6db default
parent child Browse files
Show More
@@ -35,6 +35,7 b' from . import ('
35 35 mdiff,
36 36 pathutil,
37 37 scmutil,
38 similar,
38 39 util,
39 40 )
40 41 stringio = util.stringio
@@ -2521,6 +2522,9 b' def trydiff(repo, revs, ctx1, ctx2, modi'
2521 2522 header.append('old mode %s' % mode1)
2522 2523 header.append('new mode %s' % mode2)
2523 2524 if copyop is not None:
2525 if opts.showsimilarity:
2526 sim = similar.score(ctx1[path1], ctx2[path2]) * 100
2527 header.append('similarity index %d%%' % sim)
2524 2528 header.append('%s from %s' % (copyop, path1))
2525 2529 header.append('%s to %s' % (copyop, path2))
2526 2530 elif revs and not repo.ui.quiet:
@@ -229,6 +229,20 b' Git diff, adding space'
229 229 -a
230 230 +b
231 231
232 Git diff, adding extended headers
233
234 $ hg diff --git --config experimental.extendedheader.index=7 --config experimental.extendedheader.similarity=True
235 diff --git a/f1 b/f 1
236 similarity index 0%
237 rename from f1
238 rename to f 1
239 index 7898192..6178079 100644
240 --- a/f1
241 +++ b/f 1
242 @@ -1,1 +1,1 @@
243 -a
244 +b
245
232 246 Git diff with noprefix
233 247
234 248 $ hg --config diff.noprefix=True diff --git --nodates
General Comments 0
You need to be logged in to leave comments. Login now