Attachment 'rcpath.py'
Download 1 # Mercurial extension to provide the 'hg children' command
2 #
3 # Copyright 2008 by Gabor Grothendieck <ggrothendieck@gmail.com>
4 # Author(s):
5 # Gabor Grothendieck <ggrothendieck@gmail.com>
6 #
7 # This software may be used and distributed according to the terms
8 # of the GNU General Public License, incorporated herein by reference.
9
10 from mercurial import commands, hg
11 from mercurial.util import rcpath
12 from mercurial.i18n import _
13 import os.path
14
15 def uniq(x):
16 u = []
17 for el in x:
18 if el not in u:
19 u.append(el)
20 return u
21
22 def rcpath_cmd(ui, **opts):
23 """show path/file names to startup files"""
24 all_opt = bool(opts['all'])
25 notused_opt = bool(opts['notused'])
26 rc = rcpath()
27 duplicates_opt = bool(opts['duplicates'])
28 if not duplicates_opt:
29 rc = uniq(rc)
30 if not all_opt:
31 if notused_opt:
32 rc = [f for f in rc if not os.path.exists(f)]
33 else:
34 rc = [f for f in rc if os.path.exists(f)]
35 for f in rc:
36 print f
37
38 commands.norepo += " rcpath"
39 cmdtable = {
40 "rcpath":
41 (rcpath_cmd,
42 [('a', 'all', None, _('all path/names that could be used')),
43 ('d', 'duplicates', None, _('retain duplicates')),
44 ('n', 'notused', None, _('path/names not currently in use'))],
45 _('hg rcpath')),
46 }
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.