Mercurial > public > mercurial-scm > hg-stable
diff mercurial/archival.py @ 24681:33ab99a6ad9b
archive: look for first visible revision to build repo identity (issue4591)
No test for the case where all revisions are hidden because "archive" command
aborts if the target revision is null.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 08 Apr 2015 23:30:02 +0900 |
parents | fbcace19534f |
children | 5115d03440f4 dc05a10e1e45 |
line wrap: on
line diff
--- a/mercurial/archival.py Wed Apr 08 22:42:37 2015 +0900 +++ b/mercurial/archival.py Wed Apr 08 23:30:02 2015 +0900 @@ -54,11 +54,17 @@ return kind return None +def _rootctx(repo): + # repo[0] may be hidden + for rev in repo: + return repo[rev] + return repo['null'] + def buildmetadata(ctx): '''build content of .hg_archival.txt''' repo = ctx.repo() base = 'repo: %s\nnode: %s\nbranch: %s\n' % ( - repo[0].hex(), ctx.hex(), encoding.fromlocal(ctx.branch())) + _rootctx(repo).hex(), ctx.hex(), encoding.fromlocal(ctx.branch())) tags = ''.join('tag: %s\n' % t for t in ctx.tags() if repo.tagtype(t) == 'global')