# HG changeset patch # User Guillermo PĂ©rez # Date 1353016623 28800 # Node ID 7ac2a7720724529fa149ac91f2bae3c2253ec643 # Parent 66b9832331c99f03374570d2cf1f2778513c793c diff: rewrite diffline Make diffline more readable, using strings with placeholders rather than appending to a list from many ifs that makes difficult to understand the actual output format. diff -r 66b9832331c9 -r 7ac2a7720724 mercurial/patch.py --- a/mercurial/patch.py Thu Nov 15 13:52:51 2012 -0800 +++ b/mercurial/patch.py Thu Nov 15 13:57:03 2012 -0800 @@ -1664,19 +1664,17 @@ return os.path.join(prefix, f) def diffline(a, b, revs): - if repo.ui.quiet and not opts.git: - return '' - parts = ['diff'] if opts.git: - parts.append('--git') - if revs and not opts.git: - parts.append(' '.join(["-r %s" % rev for rev in revs])) - if opts.git: - parts.append('a/%s' % a) - parts.append('b/%s' % b) + line = 'diff --git a/%s b/%s\n' % (a, b) + elif not repo.ui.quiet: + if revs: + revinfo = ' '.join(["-r %s" % rev for rev in revs]) + line = 'diff %s %s\n' % (revinfo, a) + else: + line = 'diff %s\n' % a else: - parts.append(a) - return ' '.join(parts) + '\n' + line = '' + return line date1 = util.datestr(ctx1.date()) man1 = ctx1.manifest()