Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 23662:bc7d90c966d2
trydiff: extract 'date2' variable like existing 'date1'
Note that there is a comment saying "ctx2 date may be dynamic". The
comment was introduced in dccb83241dd0 (patch: use contexts for diff,
2006-12-25), but it seems like it stopped being dynamic in that very
changeset -- before that changeset, the date seems to have been the
file's mtime, but after the changeset, it seems to be the changeset's
timestamp (current time for workingctx). Since no one seems to have
missed the "dynamicness", let's simplify and extract a date2 for
symmetry with date1.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 23 Dec 2014 14:56:30 -0800 |
parents | dbd60f8d88d5 |
children | a9853fc172d2 |
comparison
equal
deleted
inserted
replaced
23661:dbd60f8d88d5 | 23662:bc7d90c966d2 |
---|---|
1782 else: | 1782 else: |
1783 line = '' | 1783 line = '' |
1784 return line | 1784 return line |
1785 | 1785 |
1786 date1 = util.datestr(ctx1.date()) | 1786 date1 = util.datestr(ctx1.date()) |
1787 date2 = util.datestr(ctx2.date()) | |
1787 man1 = ctx1.manifest() | 1788 man1 = ctx1.manifest() |
1788 | 1789 |
1789 gone = set() | 1790 gone = set() |
1790 gitmode = {'l': '120000', 'x': '100755', '': '100644'} | 1791 gitmode = {'l': '120000', 'x': '100755', '': '100644'} |
1791 | 1792 |
1876 text = mdiff.b85diff(to, tn) | 1877 text = mdiff.b85diff(to, tn) |
1877 if text: | 1878 if text: |
1878 addindexmeta(header, [gitindex(to), gitindex(tn)]) | 1879 addindexmeta(header, [gitindex(to), gitindex(tn)]) |
1879 else: | 1880 else: |
1880 text = mdiff.unidiff(to, date1, | 1881 text = mdiff.unidiff(to, date1, |
1881 # ctx2 date may be dynamic | 1882 tn, date2, |
1882 tn, util.datestr(ctx2.date()), | 1883 join(a), join(b), opts=opts) |
1883 join(a), join(b), opts=opts) | |
1884 if header and (text or len(header) > 1): | 1884 if header and (text or len(header) > 1): |
1885 yield ''.join(header) | 1885 yield ''.join(header) |
1886 if text: | 1886 if text: |
1887 yield text | 1887 yield text |
1888 | 1888 |