Kacper Kowalik avatar Kacper Kowalik committed f3a2076

handle API changes between 1.8 and 1.9 in mercurial

Comments (0)

Files changed (1)

 from __future__ import with_statement
 from iniparse import SafeConfigParser
 from mercurial.i18n import _
-from mercurial import commands, hg, util, error
+from mercurial import commands, hg, error
+    from mercurial.scmutil import systemrcpath
+    from mercurial.scmutil import userrcpath
+    from mercurial.scmutil import osrcpath
+    from mercurial.scmutil import rcpath
+except ImportError:
+    from mercurial.util import system_rcpath as systemrcpath
+    from mercurial.util import user_rcpath as userrcpath
+    from mercurial.util import os_rcpath as osrcpath
+    from mercurial.util import rcpath
 from ConfigParser import NoOptionError, NoSectionError
 import os
 import sys
     elif 'HGRCPATH' in os.environ:
         path = os.environ['HGRCPATH'].split(os.pathsep)[0]
-        path = util.user_rcpath()[0]
+        path = userrcpath()[0]
     if not os.path.exists(path):
         with open(path, "wb") as _empty:
             pass # create empty file
 def defaultpath(pathtype, ui, path = ""):
     if pathtype == "user":
-        paths = util.user_rcpath()
+        paths = userrcpath()
         path = os.path.abspath(paths[len(paths)-1])
     elif pathtype == "global":
         if os.name == 'posix':
     def setpaths(self):
-        paths = util.rcpath()
-        paths.extend(util.os_rcpath())
+        paths = rcpath()
+        paths.extend(osrcpath())
         self._paths = verifypaths(paths)
         if existslocalrepo():
             # This is a little silly, since without a valid config file
             # how could this extension be loaded? But for completeness...
-            self._path = default = util.user_rcpath()[0]
+            self._path = default = userrcpath()[0]
             msg = _("Unable to find configuration file."
                     " Would you like to make one at %s?") % default
             index = self._ui.promptchoice(msg, [_('&yes'), _('&no')], 0)
         pathtype = "[other]"
         if path == repoconfpath():
             pathtype = "[repository]"
-        if path in util.user_rcpath():
+        if path in userrcpath():
             pathtype = "[user]"
-        elif path in util.system_rcpath():
+        elif path in systemrcpath():
             pathtype = "[system-wide]"
         elif 'HGRCPATH' in os.environ:
             if path in os.environ['HGRCPATH'].split(os.pathsep):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.