##// END OF EJS Templates
archive: look for first visible revision to build repo identity (issue4591)...
Yuya Nishihara -
r24681:33ab99a6 default
parent child Browse files
Show More
@@ -54,11 +54,17 b' def guesskind(dest):'
54 return kind
54 return kind
55 return None
55 return None
56
56
57 def _rootctx(repo):
58 # repo[0] may be hidden
59 for rev in repo:
60 return repo[rev]
61 return repo['null']
62
57 def buildmetadata(ctx):
63 def buildmetadata(ctx):
58 '''build content of .hg_archival.txt'''
64 '''build content of .hg_archival.txt'''
59 repo = ctx.repo()
65 repo = ctx.repo()
60 base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
66 base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
61 repo[0].hex(), ctx.hex(), encoding.fromlocal(ctx.branch()))
67 _rootctx(repo).hex(), ctx.hex(), encoding.fromlocal(ctx.branch()))
62
68
63 tags = ''.join('tag: %s\n' % t for t in ctx.tags()
69 tags = ''.join('tag: %s\n' % t for t in ctx.tags()
64 if repo.tagtype(t) == 'global')
70 if repo.tagtype(t) == 'global')
@@ -250,6 +250,30 b' We need to create a clone of 5 and add a'
250 o 0:1f0dee641bb7 (public) [ ] add a
250 o 0:1f0dee641bb7 (public) [ ] add a
251
251
252
252
253 $ cd ..
254
255 Revision 0 is hidden
256 --------------------
257
258 $ hg init rev0hidden
259 $ cd rev0hidden
260
261 $ mkcommit kill0
262 $ hg up -q null
263 $ hg debugobsolete `getid kill0`
264 $ mkcommit a
265 $ mkcommit b
266
267 Should pick the first visible revision as "repo" node
268
269 $ hg archive ../archive-null
270 $ cat ../archive-null/.hg_archival.txt
271 repo: 1f0dee641bb7258c56bd60e93edfa2405381c41e
272 node: 7c3bad9141dcb46ff89abf5f61856facd56e476c
273 branch: default
274 latesttag: null
275 latesttagdistance: 2
276 changessincelatesttag: 2
253
277
254
278
255 $ cd ..
279 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now