Mercurial > hg
comparison mercurial/patch.py @ 23300:f8b5c3e77d4b
patch.trydiff: add support for noprefix
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 12 Nov 2014 23:50:21 -0800 |
parents | d7abae94a7a0 |
children | f35526b999f4 |
comparison
equal
deleted
inserted
replaced
23299:1f510efcd5f3 | 23300:f8b5c3e77d4b |
---|---|
1736 l = len(text) | 1736 l = len(text) |
1737 s = util.sha1('blob %d\0' % l) | 1737 s = util.sha1('blob %d\0' % l) |
1738 s.update(text) | 1738 s.update(text) |
1739 return s.hexdigest() | 1739 return s.hexdigest() |
1740 | 1740 |
1741 if opts.noprefix: | |
1742 aprefix = bprefix = '' | |
1743 else: | |
1744 aprefix = 'a/' | |
1745 bprefix = 'b/' | |
1746 | |
1741 def diffline(a, b, revs): | 1747 def diffline(a, b, revs): |
1742 if opts.git: | 1748 if opts.git: |
1743 line = 'diff --git a/%s b/%s\n' % (a, b) | 1749 line = 'diff --git %s%s %s%s\n' % (aprefix, a, bprefix, b) |
1744 elif not repo.ui.quiet: | 1750 elif not repo.ui.quiet: |
1745 if revs: | 1751 if revs: |
1746 revinfo = ' '.join(["-r %s" % rev for rev in revs]) | 1752 revinfo = ' '.join(["-r %s" % rev for rev in revs]) |
1747 line = 'diff %s %s\n' % (revinfo, a) | 1753 line = 'diff %s %s\n' % (revinfo, a) |
1748 else: | 1754 else: |