Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1.1, 2.1.2, and tip

stable hgcrutil: add missing import of _() (closes #852)

Changeset 68c9b78ad92e

Parent d9aacc4a5e1c

by Steve Borho

Changes to one file · Browse files at 68c9b78ad92e Showing diff from parent d9aacc4a5e1c Diff from another changeset...

1
2
3
4
5
6
7
8
9
 
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 # hgrcutils.py - Functions to manipulate hgrc (or similar) files  #  # Copyright 2011 Angel Ezquerra <angel.ezquerra@gmail.com>  #  # This software may be used and distributed according to the terms of the  # GNU General Public License version 2 or any later version.    import os   +from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import qtlib  from tortoisehg.util import wconfig    def loadIniFile(rcpath, parent=None):   for fn in rcpath:   if os.path.exists(fn):   break   else:   for fn in rcpath:   # Try to create a file from rcpath   try:   f = open(fn, 'w')   f.write('# Generated by TortoiseHg\n')   f.close()   break   except EnvironmentError:   pass   else:   qtlib.WarningMsgBox(_('Unable to create a config file'),   _('Insufficient access rights.'), parent=parent)   return None, {}     return fn, wconfig.readfile(fn)    def setConfigValue(rcfilepath, cfgpath, value):   '''   Set a value on a config file, such as an hgrc or a .ini file     rcpfilepath: Absolute path to a configuration file   cfgpath: Full "path" of a configurable key   Format is section.keyNamee.g. 'web.name')   value: String value for the selected config key   '''   fn, cfg = loadIniFile([rcfilepath])   if not hasattr(cfg, 'write'):   return False   if fn is None:   return False   cfgFullKey = cfgpath.split('.')   if len(cfgFullKey) < 2:   return False   cfg.set(cfgFullKey[0], cfgFullKey[1], value)   try:   wconfig.writefile(cfg, fn)   except EnvironmentError, e:   return False   return True