Show More
@@ -30,7 +30,9 from mercurial.node import ( | |||
|
30 | 30 | from mercurial import ( |
|
31 | 31 | logexchange, |
|
32 | 32 | namespaces, |
|
33 | pycompat, | |
|
33 | 34 | registrar, |
|
35 | templatekw, | |
|
34 | 36 | ) |
|
35 | 37 | |
|
36 | 38 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
@@ -41,6 +43,7 testedwith = 'ships-with-hg-core' | |||
|
41 | 43 | |
|
42 | 44 | configtable = {} |
|
43 | 45 | configitem = registrar.configitem(configtable) |
|
46 | templatekeyword = registrar.templatekeyword() | |
|
44 | 47 | |
|
45 | 48 | configitem('remotenames', 'bookmarks', |
|
46 | 49 | default=True, |
@@ -205,3 +208,51 def reposetup(ui, repo): | |||
|
205 | 208 | nodemap = lambda repo, node: |
|
206 | 209 | repo._remotenames.nodetobranch().get(node, [])) |
|
207 | 210 | repo.names.addnamespace(remotebranchns) |
|
211 | ||
|
212 | @templatekeyword('remotenames') | |
|
213 | def remotenameskw(**args): | |
|
214 | """:remotenames: List of strings. List of remote names associated with the | |
|
215 | changeset. | |
|
216 | """ | |
|
217 | args = pycompat.byteskwargs(args) | |
|
218 | repo, ctx = args['repo'], args['ctx'] | |
|
219 | ||
|
220 | remotenames = [] | |
|
221 | if 'remotebookmarks' in repo.names: | |
|
222 | remotenames = repo.names['remotebookmarks'].names(repo, ctx.node()) | |
|
223 | ||
|
224 | if 'remotebranches' in repo.names: | |
|
225 | remotenames += repo.names['remotebranches'].names(repo, ctx.node()) | |
|
226 | ||
|
227 | return templatekw.showlist('remotename', remotenames, args, | |
|
228 | plural='remotenames') | |
|
229 | ||
|
230 | @templatekeyword('remotebookmarks') | |
|
231 | def remotebookmarkskw(**args): | |
|
232 | """:remotebookmarks: List of strings. List of remote bookmarks associated | |
|
233 | with the changeset. | |
|
234 | """ | |
|
235 | args = pycompat.byteskwargs(args) | |
|
236 | repo, ctx = args['repo'], args['ctx'] | |
|
237 | ||
|
238 | remotebmarks = [] | |
|
239 | if 'remotebookmarks' in repo.names: | |
|
240 | remotebmarks = repo.names['remotebookmarks'].names(repo, ctx.node()) | |
|
241 | ||
|
242 | return templatekw.showlist('remotebookmark', remotebmarks, args, | |
|
243 | plural='remotebookmarks') | |
|
244 | ||
|
245 | @templatekeyword('remotebranches') | |
|
246 | def remotebrancheskw(**args): | |
|
247 | """:remotebranches: List of strings. List of remote branches associated | |
|
248 | with the changeset. | |
|
249 | """ | |
|
250 | args = pycompat.byteskwargs(args) | |
|
251 | repo, ctx = args['repo'], args['ctx'] | |
|
252 | ||
|
253 | remotebranches = [] | |
|
254 | if 'remotebranches' in repo.names: | |
|
255 | remotebranches = repo.names['remotebranches'].names(repo, ctx.node()) | |
|
256 | ||
|
257 | return templatekw.showlist('remotebranch', remotebranches, args, | |
|
258 | plural='remotebranches') |
@@ -182,3 +182,47 Pulling form the new server | |||
|
182 | 182 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
183 | 183 | summary: Added a |
|
184 | 184 | |
|
185 | Testing the templates provided by remotenames extension | |
|
186 | ||
|
187 | `remotenames` keyword | |
|
188 | ||
|
189 | $ hg log -G -T "{rev}:{node|short} {remotenames}\n" | |
|
190 | @ 8:3e1487808078 $TESTTMP/server2/wat default/wat | |
|
191 | | | |
|
192 | | o 7:ec2426147f0e $TESTTMP/server2/default default/default | |
|
193 | | | | |
|
194 | | o 6:87d6d6676308 $TESTTMP/server2/bar default/bar | |
|
195 | | | | |
|
196 | | o 5:825660c69f0c | |
|
197 | |/ | |
|
198 | o 4:aa98ab95a928 | |
|
199 | | | |
|
200 | o 3:62615734edd5 $TESTTMP/server2/foo default/foo | |
|
201 | | | |
|
202 | o 2:28ad74487de9 | |
|
203 | | | |
|
204 | o 1:29becc82797a | |
|
205 | | | |
|
206 | o 0:18d04c59bb5d | |
|
207 | ||
|
208 | `remotebookmarks` and `remotebranches` keywords | |
|
209 | ||
|
210 | $ hg log -G -T "{rev}:{node|short} [{remotebookmarks}] ({remotebranches})" | |
|
211 | @ 8:3e1487808078 [] ($TESTTMP/server2/wat default/wat) | |
|
212 | | | |
|
213 | | o 7:ec2426147f0e [] ($TESTTMP/server2/default default/default) | |
|
214 | | | | |
|
215 | | o 6:87d6d6676308 [$TESTTMP/server2/bar default/bar] () | |
|
216 | | | | |
|
217 | | o 5:825660c69f0c [] () | |
|
218 | |/ | |
|
219 | o 4:aa98ab95a928 [] () | |
|
220 | | | |
|
221 | o 3:62615734edd5 [$TESTTMP/server2/foo default/foo] () | |
|
222 | | | |
|
223 | o 2:28ad74487de9 [] () | |
|
224 | | | |
|
225 | o 1:29becc82797a [] () | |
|
226 | | | |
|
227 | o 0:18d04c59bb5d [] () | |
|
228 |
General Comments 0
You need to be logged in to leave comments.
Login now