##// END OF EJS Templates
keyword: make kwdemo less verbose...
Christian Ebert -
r10713:b9c3f8e8 default
parent child Browse files
Show More
@@ -287,7 +287,6 b' def demo(ui, repo, *args, **opts):'
287 ui.write('%s = %s\n' % (k, v))
287 ui.write('%s = %s\n' % (k, v))
288
288
289 fn = 'demo.txt'
289 fn = 'demo.txt'
290 branchname = 'demobranch'
291 tmpdir = tempfile.mkdtemp('', 'kwdemo.')
290 tmpdir = tempfile.mkdtemp('', 'kwdemo.')
292 ui.note(_('creating temporary repository at %s\n') % tmpdir)
291 ui.note(_('creating temporary repository at %s\n') % tmpdir)
293 repo = localrepo.localrepository(ui, tmpdir, True)
292 repo = localrepo.localrepository(ui, tmpdir, True)
@@ -333,25 +332,17 b' def demo(ui, repo, *args, **opts):'
333 keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n'
332 keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n'
334 repo.wopener(fn, 'w').write(keywords)
333 repo.wopener(fn, 'w').write(keywords)
335 repo.add([fn])
334 repo.add([fn])
336 path = repo.wjoin(fn)
335 ui.note(_('\nkeywords written to %s:\n') % fn)
337 ui.note(_('\nkeywords written to %s:\n') % path)
338 ui.note(keywords)
336 ui.note(keywords)
339 ui.note('\nhg -R "%s" branch "%s"\n' % (tmpdir, branchname))
337 repo.dirstate.setbranch('demobranch')
340 # silence branch command if not verbose
341 quiet = ui.quiet
342 ui.quiet = not ui.verbose
343 commands.branch(ui, repo, branchname)
344 ui.quiet = quiet
345 for name, cmd in ui.configitems('hooks'):
338 for name, cmd in ui.configitems('hooks'):
346 if name.split('.', 1)[0].find('commit') > -1:
339 if name.split('.', 1)[0].find('commit') > -1:
347 repo.ui.setconfig('hooks', name, '')
340 repo.ui.setconfig('hooks', name, '')
348 ui.note(_('unhooked all commit hooks\n'))
349 msg = _('hg keyword configuration and expansion example')
341 msg = _('hg keyword configuration and expansion example')
350 ui.note("hg -R '%s' ci -m '%s'\n" % (tmpdir, msg))
342 ui.note("hg ci -m '%s'\n" % msg)
351 repo.commit(text=msg)
343 repo.commit(text=msg)
352 ui.status(_('\n\tkeywords expanded\n'))
344 ui.status(_('\n\tkeywords expanded\n'))
353 ui.write(repo.wread(fn))
345 ui.write(repo.wread(fn))
354 ui.debug('\nremoving temporary repository %s\n' % tmpdir)
355 shutil.rmtree(tmpdir, ignore_errors=True)
346 shutil.rmtree(tmpdir, ignore_errors=True)
356
347
357 def expand(ui, repo, *pats, **opts):
348 def expand(ui, repo, *pats, **opts):
General Comments 0
You need to be logged in to leave comments. Login now