Steve Borho  committed 6442338

hglib: isolate scmutil knowledge to until thg 2.1

  • Participants
  • Parent commits c8e1bd3

Comments (0)

Files changed (6)

File tortoisehg/hgqt/

 import os
-from mercurial import ui, scmutil, util, error
+from mercurial import ui, util, error
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
     def saveGlobal(self):
-        self.saveToPath(scmutil.user_rcpath())
+        self.saveToPath(hglib.user_rcpath())
     def saveToPath(self, path):
         fn, cfg = qtlib.loadIniFile(path, self)

File tortoisehg/hgqt/

                       'from folder<p>%s</p>' % cwd))
             return ('', '')
-            fname = util.canonpath(self.root, cwd, pats[0])
-            target = util.canonpath(self.root, cwd, pats[1])
+            fname = hglib.canonpath(self.root, cwd, pats[0])
+            target = hglib.canonpath(self.root, cwd, pats[1])
         cmdline, vcl = self.compose_command(src, dest)
         self.show_command((cmdline, vcl))
-        new_name = util.canonpath(self.root, self.root, new_name)
+        new_name = hglib.canonpath(self.root, self.root, new_name)
         if self.isCaseFoldingOnWin():
             # We do the rename ourselves if it's a pure casefolding
             # action on Windows. Because there is no way to make Hg

File tortoisehg/hgqt/

 from PyQt4.QtGui import *
 import mercurial.ui as uimod
-from mercurial import hg, scmutil, util, fancyopts, cmdutil, extensions, error
+from mercurial import hg, util, fancyopts, cmdutil, extensions, error
 from tortoisehg.hgqt.i18n import agettext as _
 from tortoisehg.util import hglib, paths, shlib, i18n
     files = []
     for f in lines:
-            cpath = scmutil.canonpath(root, cwd, f)
+            cpath = hglib.canonpath(root, cwd, f)
             # canonpath will abort on .hg/ paths
         except util.Abort:

File tortoisehg/hgqt/

 import os
-from mercurial import ui, scmutil, util, error
+from mercurial import ui, util, error
 from tortoisehg.util import hglib, settings, paths, wconfig, i18n, bugtraq
 from tortoisehg.hgqt.i18n import _
         self.conftabs = QTabWidget()
-        utab = SettingsForm(rcpath=scmutil.user_rcpath(), focus=focus)
+        utab = SettingsForm(rcpath=hglib.user_rcpath(), focus=focus)
         self.conftabs.addTab(utab, qtlib.geticon('settings_user'),
                              _("%s's global settings") % username())
                 w = func(opts)
             if e.globalonly:
-                w.setEnabled(self.rcpath == scmutil.user_rcpath())
+                w.setEnabled(self.rcpath == hglib.user_rcpath())
             lbl = QLabel(e.label)

File tortoisehg/hgqt/

 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
-from mercurial import hg, ui, url, scmutil, util, error, demandimport
+from mercurial import hg, ui, url, util, error, demandimport
 from mercurial import merge as mergemod
 from tortoisehg.util import hglib, wconfig
     def accept(self):
-        path = scmutil.user_rcpath()
+        path = hglib.user_rcpath()
         fn, cfg = qtlib.loadIniFile(path, self)
         if not hasattr(cfg, 'write'):
             qtlib.WarningMsgBox(_('Unable to save authentication'),

File tortoisehg/util/

 from mercurial import ui, util, extensions, match, bundlerepo, url, cmdutil
 from mercurial import dispatch, encoding, templatefilters, filemerge, error
-from mercurial import scmutil
+from mercurial import demandimport
+    # hg >= 1.9
+    from mercurial.scmutil import canonpath, user_rcpath
+except (ImportError, AttributeError):
+    # hg <= 1.8
+    from mercurial.util import canonpath, user_rcpath
 _encoding = encoding.encoding
 _encodingmode = encoding.encodingmode
     root = paths.find_root(cwd)
     for f in list:
-            canonpats.append(scmutil.canonpath(root, cwd, f))
+            canonpats.append(canonpath(root, cwd, f))
         except util.Abort:
             # Attempt to resolve case folding conflicts.
             fu = f.upper()
             cwdu = cwd.upper()
             if fu.startswith(cwdu):
-                canonpats.append(scmutil.canonpath(root, cwd, f[len(cwd+os.sep):]))
+                canonpats.append(canonpath(root, cwd, f[len(cwd+os.sep):]))
                 # May already be canonical