Mercurial > hg
comparison mercurial/archival.py @ 23645:242d11819c6c
archive: store number of changes since latest tag as well
This is different from latesttagdistance in that while latesttagdistance is
defined to be the length of the longest path to the latest tag,
changessincelatesttag is the number of changes contained in @ that aren't
contained in the latest tag. So, if 't' is the latest tag in the repository
below:
t
|
v
--o--o----o
\ \
..o..o..@
then latesttagdistance is 2, but changessincelatesttag is 4.
Note that changessincelatesttag is always greater than or equal to the
latesttagdistance -- that's because changessincelatesttag counts all the
changes in the longest path since the latest tag, and possibly others. This is
an important fact that we'll take advantage of in upcoming patches.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 12 Dec 2014 15:27:13 -0800 |
parents | a2f139d25845 |
children | e0f06228bb66 |
comparison
equal
deleted
inserted
replaced
23644:17b2ab77f453 | 23645:242d11819c6c |
---|---|
274 repo.ui.pushbuffer() | 274 repo.ui.pushbuffer() |
275 opts = {'template': '{latesttag}\n{latesttagdistance}', | 275 opts = {'template': '{latesttag}\n{latesttagdistance}', |
276 'style': '', 'patch': None, 'git': None} | 276 'style': '', 'patch': None, 'git': None} |
277 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) | 277 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) |
278 ltags, dist = repo.ui.popbuffer().split('\n') | 278 ltags, dist = repo.ui.popbuffer().split('\n') |
279 tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':')) | 279 ltags = ltags.split(':') |
280 changessince = len(repo.revs('only(.,%s)', ltags[0])) | |
281 tags = ''.join('latesttag: %s\n' % t for t in ltags) | |
280 tags += 'latesttagdistance: %s\n' % dist | 282 tags += 'latesttagdistance: %s\n' % dist |
283 tags += 'changessincelatesttag: %s\n' % changessince | |
281 | 284 |
282 return base + tags | 285 return base + tags |
283 | 286 |
284 name = '.hg_archival.txt' | 287 name = '.hg_archival.txt' |
285 if not matchfn or matchfn(name): | 288 if not matchfn or matchfn(name): |