##// END OF EJS Templates
archive: rewrite default metadata template as a multi-line bytes literal...
Yuya Nishihara -
r35923:887bbce7 default
parent child Browse files
Show More
@@ -76,29 +76,27 b' def _rootctx(repo):'
76 return repo[rev]
76 return repo[rev]
77 return repo['null']
77 return repo['null']
78
78
79 # {tags} on ctx includes local tags and 'tip', with no current way to limit
80 # that to global tags. Therefore, use {latesttag} as a substitute when
81 # the distance is 0, since that will be the list of global tags on ctx.
82 _defaultmetatemplate = br'''
83 repo: {root}
84 node: {ifcontains(rev, revset("wdir()"), "{p1node}{dirty}", "{node}")}
85 branch: {branch|utf8}
86 {ifeq(latesttagdistance, 0, join(latesttag % "tag: {tag}", "\n"),
87 separate("\n",
88 join(latesttag % "latesttag: {tag}", "\n"),
89 "latesttagdistance: {latesttagdistance}",
90 "changessincelatesttag: {changessincelatesttag}"))}
91 '''[1:] # drop leading '\n'
92
79 def buildmetadata(ctx):
93 def buildmetadata(ctx):
80 '''build content of .hg_archival.txt'''
94 '''build content of .hg_archival.txt'''
81 repo = ctx.repo()
95 repo = ctx.repo()
82
96
83 default = (
84 r'repo: {root}\n'
85 r'node: {ifcontains(rev, revset("wdir()"),'
86 r'"{p1node}{dirty}", "{node}")}\n'
87 r'branch: {branch|utf8}\n'
88
89 # {tags} on ctx includes local tags and 'tip', with no current way to
90 # limit that to global tags. Therefore, use {latesttag} as a substitute
91 # when the distance is 0, since that will be the list of global tags on
92 # ctx.
93 r'{ifeq(latesttagdistance, 0, latesttag % "tag: {tag}\n",'
94 r'"{latesttag % "latesttag: {tag}\n"}'
95 r'latesttagdistance: {latesttagdistance}\n'
96 r'changessincelatesttag: {changessincelatesttag}\n")}'
97 )
98
99 opts = {
97 opts = {
100 'template': repo.ui.config('experimental', 'archivemetatemplate',
98 'template': repo.ui.config('experimental', 'archivemetatemplate',
101 default)
99 _defaultmetatemplate)
102 }
100 }
103
101
104 out = util.stringio()
102 out = util.stringio()
General Comments 0
You need to be logged in to leave comments. Login now