changeset 37204:0d6c12668691

inifnitepush: use utils.{stringutil|procutil}.* instead of util.* Recently in core, util.py is splitted into various modules in mercurial/utils/. Differential Revision: https://phab.mercurial-scm.org/D2956
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 27 Mar 2018 14:15:42 +0530
parents f083e7fd6313
children e5cd0ef5c362
files hgext/infinitepush/__init__.py hgext/infinitepush/fileindexapi.py
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/infinitepush/__init__.py	Fri Mar 30 12:50:06 2018 -0700
+++ b/hgext/infinitepush/__init__.py	Tue Mar 27 14:15:42 2018 +0530
@@ -101,6 +101,11 @@
 
 from mercurial.i18n import _
 
+from mercurial.utils import (
+    procutil,
+    stringutil,
+)
+
 from mercurial import (
     bundle2,
     changegroup,
@@ -270,7 +275,8 @@
     scratchbranchpat = ui.config('infinitepush', 'branchpattern')
     if scratchbranchpat:
         global _scratchbranchmatcher
-        kind, pat, _scratchbranchmatcher = util.stringmatcher(scratchbranchpat)
+        kind, pat, _scratchbranchmatcher = \
+                stringutil.stringmatcher(scratchbranchpat)
 
 def serverextsetup(ui):
     origpushkeyhandler = bundle2.parthandlermapping['pushkey']
@@ -331,7 +337,7 @@
             results.update(index.getbookmarks(pattern))
             if pattern.endswith('*'):
                 pattern = 're:^' + pattern[:-1] + '.*'
-            kind, pat, matcher = util.stringmatcher(pattern)
+            kind, pat, matcher = stringutil.stringmatcher(pattern)
             for bookmark, node in bookmarks.iteritems():
                 if matcher(bookmark):
                     results[bookmark] = node
@@ -843,7 +849,7 @@
     if not logger:
         ui = op.repo.ui
         try:
-            username = util.getuser()
+            username = procutil.getuser()
         except Exception:
             username = 'unknown'
         # Generate random request id to be able to find all logged entries
--- a/hgext/infinitepush/fileindexapi.py	Fri Mar 30 12:50:06 2018 -0700
+++ b/hgext/infinitepush/fileindexapi.py	Tue Mar 27 14:15:42 2018 +0530
@@ -15,7 +15,7 @@
 
 import os
 
-from mercurial import util
+from mercurial.utils import stringutil
 
 from . import indexapi
 
@@ -77,7 +77,7 @@
     def _listbookmarks(self, pattern):
         if pattern.endswith('*'):
             pattern = 're:^' + pattern[:-1] + '.*'
-        kind, pat, matcher = util.stringmatcher(pattern)
+        kind, pat, matcher = stringutil.stringmatcher(pattern)
         prefixlen = len(self._bookmarkmap) + 1
         for dirpath, _, books in self._repo.vfs.walk(self._bookmarkmap):
             for book in books: