merge with abuehl
authorMatt Mackall <mpm@selenic.com>
Fri, 06 May 2011 13:04:24 -0500
changeset 14238 d466d592e8cf
parent 14223 e456084a3ecc (current diff)
parent 14237 4d684d8210a1 (diff)
child 14239 967be4bb42a7
merge with abuehl
mercurial/commands.py
--- a/contrib/dumprevlog	Fri May 06 11:51:18 2011 -0500
+++ b/contrib/dumprevlog	Fri May 06 13:04:24 2011 -0500
@@ -6,7 +6,7 @@
 from mercurial import revlog, node, util
 
 for fp in (sys.stdin, sys.stdout, sys.stderr):
-    util.set_binary(fp)
+    util.setbinary(fp)
 
 for f in sys.argv[1:]:
     binopen = lambda fn: open(fn, 'rb')
--- a/contrib/shrink-revlog.py	Fri May 06 11:51:18 2011 -0500
+++ b/contrib/shrink-revlog.py	Fri May 06 13:04:24 2011 -0500
@@ -251,8 +251,8 @@
         if not opts.get('dry_run'):
             # racy, both files cannot be renamed atomically
             # copy files
-            util.os_link(indexfn, oldindexfn)
-            ignoremissing(util.os_link)(datafn, olddatafn)
+            util.oslink(indexfn, oldindexfn)
+            ignoremissing(util.oslink)(datafn, olddatafn)
 
             # rename
             util.rename(tmpindexfn, indexfn)
--- a/contrib/simplemerge	Fri May 06 11:51:18 2011 -0500
+++ b/contrib/simplemerge	Fri May 06 13:04:24 2011 -0500
@@ -43,7 +43,7 @@
 
 try:
     for fp in (sys.stdin, sys.stdout, sys.stderr):
-        util.set_binary(fp)
+        util.setbinary(fp)
     
     opts = {}
     try:
--- a/contrib/undumprevlog	Fri May 06 11:51:18 2011 -0500
+++ b/contrib/undumprevlog	Fri May 06 13:04:24 2011 -0500
@@ -7,7 +7,7 @@
 from mercurial import revlog, node, scmutil, util, transaction
 
 for fp in (sys.stdin, sys.stdout, sys.stderr):
-    util.set_binary(fp)
+    util.setbinary(fp)
 
 opener = scmutil.opener('.', False)
 tr = transaction.transaction(sys.stderr.write, opener, "undump.journal")
--- a/hg	Fri May 06 11:51:18 2011 -0500
+++ b/hg	Fri May 06 13:04:24 2011 -0500
@@ -33,6 +33,6 @@
 import mercurial.dispatch
 
 for fp in (sys.stdin, sys.stdout, sys.stderr):
-    mercurial.util.set_binary(fp)
+    mercurial.util.setbinary(fp)
 
 mercurial.dispatch.run()
--- a/hgext/bugzilla.py	Fri May 06 11:51:18 2011 -0500
+++ b/hgext/bugzilla.py	Fri May 06 13:04:24 2011 -0500
@@ -394,7 +394,7 @@
             if ret:
                 self.ui.warn(out)
                 raise util.Abort(_('bugzilla notify command %s') %
-                                 util.explain_exit(ret)[0])
+                                 util.explainexit(ret)[0])
         self.ui.status(_('done\n'))
 
     def get_user_id(self, user):
--- a/hgext/convert/common.py	Fri May 06 11:51:18 2011 -0500
+++ b/hgext/convert/common.py	Fri May 06 13:04:24 2011 -0500
@@ -308,7 +308,7 @@
             if output:
                 self.ui.warn(_('%s error:\n') % self.command)
                 self.ui.warn(output)
-            msg = util.explain_exit(status)[0]
+            msg = util.explainexit(status)[0]
             raise util.Abort('%s %s' % (self.command, msg))
 
     def run0(self, cmd, *args, **kwargs):
--- a/hgext/convert/subversion.py	Fri May 06 11:51:18 2011 -0500
+++ b/hgext/convert/subversion.py	Fri May 06 13:04:24 2011 -0500
@@ -112,8 +112,8 @@
     """Fetch SVN log in a subprocess and channel them back to parent to
     avoid memory collection issues.
     """
-    util.set_binary(sys.stdin)
-    util.set_binary(sys.stdout)
+    util.setbinary(sys.stdin)
+    util.setbinary(sys.stdout)
     args = decodeargs(sys.stdin.read())
     get_log_child(sys.stdout, *args)
 
@@ -1011,7 +1011,7 @@
             fp = open(hook, 'w')
             fp.write(pre_revprop_change)
             fp.close()
-            util.set_flags(hook, False, True)
+            util.setflags(hook, False, True)
 
         output = self.run0('info')
         self.uuid = self.uuid_re.search(output).group(1).strip()
@@ -1038,7 +1038,7 @@
                 # systematically is just as expensive and much simpler.
                 was_exec = 'x' not in flags
 
-            util.set_flags(self.wjoin(filename), False, 'x' in flags)
+            util.setflags(self.wjoin(filename), False, 'x' in flags)
             if was_exec:
                 if 'x' not in flags:
                     self.delexec.append(filename)
--- a/hgext/extdiff.py	Fri May 06 11:51:18 2011 -0500
+++ b/hgext/extdiff.py	Fri May 06 13:04:24 2011 -0500
@@ -99,7 +99,7 @@
         else:
             wopener.write(wfn, data)
             if 'x' in fctx.flags():
-                util.set_flags(dest, False, True)
+                util.setflags(dest, False, True)
         if node is None:
             fns_and_mtime.append((dest, repo.wjoin(fn),
                                   os.lstat(dest).st_mtime))
--- a/hgext/relink.py	Fri May 06 11:51:18 2011 -0500
+++ b/hgext/relink.py	Fri May 06 13:04:24 2011 -0500
@@ -132,7 +132,7 @@
         bak = dst + '.bak'
         os.rename(dst, bak)
         try:
-            util.os_link(src, dst)
+            util.oslink(src, dst)
         except OSError:
             os.rename(bak, dst)
             raise
--- a/mercurial/cmdutil.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/cmdutil.py	Fri May 06 13:04:24 2011 -0500
@@ -369,7 +369,7 @@
             if gp.op == 'ADD' and not os.path.lexists(dst):
                 flags = (isexec and 'x' or '') + (islink and 'l' or '')
                 repo.wwrite(gp.path, '', flags)
-            util.set_flags(dst, islink, isexec)
+            util.setflags(dst, islink, isexec)
     addremove(repo, cfiles, similarity=similarity)
     files = patches.keys()
     files.extend([r for r in removes if r not in files])
--- a/mercurial/commands.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/commands.py	Fri May 06 13:04:24 2011 -0500
@@ -3758,7 +3758,7 @@
 
     class service(object):
         def init(self):
-            util.set_signal_handler()
+            util.setsignalhandler()
             self.httpd = hgweb.server.create_server(ui, app)
 
             if opts['port'] and not ui.verbose:
--- a/mercurial/filemerge.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/filemerge.py	Fri May 06 13:04:24 2011 -0500
@@ -29,7 +29,7 @@
         k = _toolstr(ui, tool, kn)
         if not k:
             continue
-        p = util.lookup_reg(k, _toolstr(ui, tool, "regname"))
+        p = util.lookupreg(k, _toolstr(ui, tool, "regname"))
         if p:
             p = util.find_exe(p + _toolstr(ui, tool, "regappend"))
             if p:
--- a/mercurial/hgweb/wsgicgi.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/hgweb/wsgicgi.py	Fri May 06 13:04:24 2011 -0500
@@ -13,8 +13,8 @@
 from mercurial.hgweb import common
 
 def launch(application):
-    util.set_binary(sys.stdin)
-    util.set_binary(sys.stdout)
+    util.setbinary(sys.stdin)
+    util.setbinary(sys.stdout)
 
     environ = dict(os.environ.iteritems())
     environ.setdefault('PATH_INFO', '')
--- a/mercurial/hook.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/hook.py	Fri May 06 13:04:24 2011 -0500
@@ -109,7 +109,7 @@
     else:
         r = util.system(cmd, environ=env, cwd=cwd)
     if r:
-        desc, r = util.explain_exit(r)
+        desc, r = util.explainexit(r)
         if throw:
             raise util.Abort(_('%s hook %s') % (name, desc))
         ui.warn(_('warning: %s hook %s\n') % (name, desc))
--- a/mercurial/localrepo.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/localrepo.py	Fri May 06 13:04:24 2011 -0500
@@ -659,7 +659,7 @@
         else:
             self.wopener.write(filename, data)
             if 'x' in flags:
-                util.set_flags(self.wjoin(filename), False, True)
+                util.setflags(self.wjoin(filename), False, True)
 
     def wwritedata(self, filename, data):
         return self._filter(self._decodefilterpats, filename, data)
--- a/mercurial/mail.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/mail.py	Fri May 06 13:04:24 2011 -0500
@@ -91,7 +91,7 @@
     if ret:
         raise util.Abort('%s %s' % (
             os.path.basename(program.split(None, 1)[0]),
-            util.explain_exit(ret)[0]))
+            util.explainexit(ret)[0]))
 
 def connect(ui):
     '''make a mail connection. return a function to send mail.
--- a/mercurial/merge.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/merge.py	Fri May 06 13:04:24 2011 -0500
@@ -336,7 +336,7 @@
                     updated += 1
                 else:
                     merged += 1
-            util.set_flags(repo.wjoin(fd), 'l' in flags, 'x' in flags)
+            util.setflags(repo.wjoin(fd), 'l' in flags, 'x' in flags)
             if (move and repo.dirstate.normalize(fd) != f
                 and os.path.lexists(repo.wjoin(f))):
                 repo.ui.debug("removing %s\n" % f)
@@ -370,7 +370,7 @@
                 repo.ui.warn(" %s\n" % nf)
         elif m == "e": # exec
             flags = a[2]
-            util.set_flags(repo.wjoin(f), 'l' in flags, 'x' in flags)
+            util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
     ms.commit()
     u.progress(_('updating'), None, total=numupdates, unit=_('files'))
 
--- a/mercurial/patch.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/patch.py	Fri May 06 13:04:24 2011 -0500
@@ -1172,7 +1172,7 @@
         line = line.rstrip()
         ui.note(line + '\n')
         if line.startswith('patching file '):
-            pf = util.parse_patch_output(line)
+            pf = util.parsepatchoutput(line)
             printed_file = False
             files.setdefault(pf, None)
         elif line.find('with fuzz') >= 0:
@@ -1191,7 +1191,7 @@
     code = fp.close()
     if code:
         raise PatchError(_("patch command failed: %s") %
-                         util.explain_exit(code)[0])
+                         util.explainexit(code)[0])
     return fuzz
 
 def internalpatch(patchobj, ui, strip, cwd, files=None, eolmode='strict'):
--- a/mercurial/posix.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/posix.py	Fri May 06 13:04:24 2011 -0500
@@ -12,7 +12,7 @@
 nulldev = '/dev/null'
 normpath = os.path.normpath
 samestat = os.path.samestat
-os_link = os.link
+oslink = os.link
 unlink = os.unlink
 rename = os.rename
 expandglobs = False
@@ -28,7 +28,7 @@
     '''return number of hardlinks for the given file'''
     return os.lstat(name).st_nlink
 
-def parse_patch_output(output_line):
+def parsepatchoutput(output_line):
     """parses the output produced by patch and returns the filename"""
     pf = output_line[14:]
     if os.sys.platform == 'OpenVMS':
@@ -48,7 +48,7 @@
     """check whether a file is executable"""
     return (os.lstat(f).st_mode & 0100 != 0)
 
-def set_flags(f, l, x):
+def setflags(f, l, x):
     s = os.lstat(f).st_mode
     if l:
         if not stat.S_ISLNK(s):
@@ -128,7 +128,7 @@
     Returns None if the path is ok, or a UI string describing the problem.'''
     pass # on posix platforms, every path is ok
 
-def set_binary(fd):
+def setbinary(fd):
     pass
 
 def pconvert(path):
@@ -210,7 +210,7 @@
     except OSError, inst:
         return inst.errno != errno.ESRCH
 
-def explain_exit(code):
+def explainexit(code):
     """return a 2-tuple (desc, code) describing a subprocess status
     (codes from kill are negative - not os.system/wait encoding)"""
     if code >= 0:
@@ -244,7 +244,7 @@
             return executable
     return None
 
-def set_signal_handler():
+def setsignalhandler():
     pass
 
 def statfiles(files):
--- a/mercurial/scmutil.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/scmutil.py	Fri May 06 13:04:24 2011 -0500
@@ -319,7 +319,7 @@
         if err.filename == path:
             raise err
     if followsym and hasattr(os.path, 'samestat'):
-        def _add_dir_if_not_there(dirlst, dirname):
+        def adddir(dirlst, dirname):
             match = False
             samestat = os.path.samestat
             dirstat = os.stat(dirname)
@@ -335,7 +335,7 @@
 
     if (seen_dirs is None) and followsym:
         seen_dirs = []
-        _add_dir_if_not_there(seen_dirs, path)
+        adddir(seen_dirs, path)
     for root, dirs, files in os.walk(path, topdown=True, onerror=errhandler):
         dirs.sort()
         if '.hg' in dirs:
@@ -352,7 +352,7 @@
             newdirs = []
             for d in dirs:
                 fname = os.path.join(root, d)
-                if _add_dir_if_not_there(seen_dirs, fname):
+                if adddir(seen_dirs, fname):
                     if os.path.islink(fname):
                         for hgname in walkrepos(fname, True, seen_dirs):
                             yield hgname
@@ -360,10 +360,10 @@
                         newdirs.append(d)
             dirs[:] = newdirs
 
-def os_rcpath():
+def osrcpath():
     '''return default os-specific hgrc search path'''
-    path = system_rcpath()
-    path.extend(user_rcpath())
+    path = systemrcpath()
+    path.extend(userrcpath())
     path = [os.path.normpath(f) for f in path]
     return path
 
@@ -390,7 +390,7 @@
                 else:
                     _rcpath.append(p)
         else:
-            _rcpath = os_rcpath()
+            _rcpath = osrcpath()
     return _rcpath
 
 if os.name != 'nt':
@@ -406,7 +406,7 @@
             pass
         return rcs
 
-    def system_rcpath():
+    def systemrcpath():
         path = []
         # old mod_python does not set sys.argv
         if len(getattr(sys, 'argv', [])) > 0:
@@ -415,17 +415,17 @@
         path.extend(rcfiles('/etc/mercurial'))
         return path
 
-    def user_rcpath():
+    def userrcpath():
         return [os.path.expanduser('~/.hgrc')]
 
 else:
 
     _HKEY_LOCAL_MACHINE = 0x80000002L
 
-    def system_rcpath():
+    def systemrcpath():
         '''return default os-specific hgrc search path'''
         rcpath = []
-        filename = util.executable_path()
+        filename = util.executablepath()
         # Use mercurial.ini found in directory with hg.exe
         progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
         if os.path.isfile(progrc):
@@ -439,8 +439,8 @@
                     rcpath.append(os.path.join(progrcd, f))
             return rcpath
         # else look for a system rcpath in the registry
-        value = util.lookup_reg('SOFTWARE\\Mercurial', None,
-                                _HKEY_LOCAL_MACHINE)
+        value = util.lookupreg('SOFTWARE\\Mercurial', None,
+                               _HKEY_LOCAL_MACHINE)
         if not isinstance(value, str) or not value:
             return rcpath
         value = value.replace('/', os.sep)
@@ -453,7 +453,7 @@
                         rcpath.append(os.path.join(p, f))
         return rcpath
 
-    def user_rcpath():
+    def userrcpath():
         '''return os-specific hgrc search path to the user dir'''
         home = os.path.expanduser('~')
         path = [os.path.join(home, 'mercurial.ini'),
--- a/mercurial/sshserver.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/sshserver.py	Fri May 06 13:04:24 2011 -0500
@@ -21,8 +21,8 @@
         sys.stdout = sys.stderr
 
         # Prevent insertion/deletion of CRs
-        util.set_binary(self.fin)
-        util.set_binary(self.fout)
+        util.setbinary(self.fin)
+        util.setbinary(self.fout)
 
     def getargs(self, args):
         data = {}
--- a/mercurial/util.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/util.py	Fri May 06 13:04:24 2011 -0500
@@ -197,7 +197,7 @@
             code = 0
         if code:
             raise Abort(_("command '%s' failed: %s") %
-                        (cmd, explain_exit(code)))
+                        (cmd, explainexit(code)))
         fp = open(outname, 'rb')
         r = fp.read()
         fp.close()
@@ -297,7 +297,7 @@
 
 _hgexecutable = None
 
-def main_is_frozen():
+def mainfrozen():
     """return True if we are a frozen executable.
 
     The code supports py2exe (most common, Windows only) and tools/freeze
@@ -315,15 +315,15 @@
     if _hgexecutable is None:
         hg = os.environ.get('HG')
         if hg:
-            set_hgexecutable(hg)
-        elif main_is_frozen():
-            set_hgexecutable(sys.executable)
+            _sethgexecutable(hg)
+        elif mainfrozen():
+            _sethgexecutable(sys.executable)
         else:
             exe = find_exe('hg') or os.path.basename(sys.argv[0])
-            set_hgexecutable(exe)
+            _sethgexecutable(exe)
     return _hgexecutable
 
-def set_hgexecutable(path):
+def _sethgexecutable(path):
     """set location of the 'hg' executable"""
     global _hgexecutable
     _hgexecutable = path
@@ -369,7 +369,7 @@
         rc = 0
     if rc and onerr:
         errmsg = '%s %s' % (os.path.basename(origcmd.split(None, 1)[0]),
-                            explain_exit(rc)[0])
+                            explainexit(rc)[0])
         if errprefix:
             errmsg = '%s: %s' % (errprefix, errmsg)
         try:
@@ -435,7 +435,7 @@
     else:
         if hardlink:
             try:
-                os_link(src, dst)
+                oslink(src, dst)
             except (IOError, OSError):
                 hardlink = False
                 shutil.copy(src, dst)
@@ -487,7 +487,7 @@
             return _("filename ends with '%s', which is not allowed "
                      "on Windows") % t
 
-def lookup_reg(key, name=None, scope=None):
+def lookupreg(key, name=None, scope=None):
     return None
 
 def hidewindow():
@@ -624,7 +624,7 @@
     fd = None
     try:
         try:
-            os_link(f1, f2)
+            oslink(f1, f2)
         except OSError:
             return False
 
@@ -1199,7 +1199,7 @@
     to avoid things opening new shell windows like batch files, so we
     get either the python call or current executable.
     """
-    if main_is_frozen():
+    if mainfrozen():
         return [sys.executable]
     return gethgcmd()
 
--- a/mercurial/win32.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/win32.py	Fri May 06 13:04:24 2011 -0500
@@ -140,7 +140,7 @@
     finally:
         _kernel32.CloseHandle(fh)
 
-def os_link(src, dst):
+def oslink(src, dst):
     try:
         if not _kernel32.CreateHardLinkA(dst, src, None):
             _raiseoserror(src)
@@ -180,7 +180,7 @@
             _kernel32.CloseHandle(h)
     return _kernel32.GetLastError() != _ERROR_INVALID_PARAMETER
 
-def lookup_reg(key, valname=None, scope=None):
+def lookupreg(key, valname=None, scope=None):
     ''' Look up a key/value name in the Windows registry.
 
     valname: value name. If unspecified, the default value for the key
@@ -218,7 +218,7 @@
         finally:
             adv.RegCloseKey(kh.value)
 
-def executable_path():
+def executablepath():
     '''return full path of hg.exe'''
     size = 600
     buf = ctypes.create_string_buffer(size + 1)
@@ -239,9 +239,9 @@
     return buf.value
 
 _SIGNAL_HANDLER = ctypes.WINFUNCTYPE(_BOOL, _DWORD)
-_signal_handler = []
+_signalhandler = []
 
-def set_signal_handler():
+def setsignalhandler():
     '''Register a termination handler for console events including
     CTRL+C. python signal handlers do not work well with socket
     operations.
@@ -249,10 +249,10 @@
     def handler(event):
         _kernel32.ExitProcess(1)
 
-    if _signal_handler:
+    if _signalhandler:
         return # already registered
     h = _SIGNAL_HANDLER(handler)
-    _signal_handler.append(h) # needed to prevent garbage collection
+    _signalhandler.append(h) # needed to prevent garbage collection
     if not _kernel32.SetConsoleCtrlHandler(h, True):
         raise ctypes.WinError()
 
--- a/mercurial/windows.py	Fri May 06 11:51:18 2011 -0500
+++ b/mercurial/windows.py	Fri May 06 13:04:24 2011 -0500
@@ -74,7 +74,7 @@
 def openhardlinks():
     return not _is_win_9x()
 
-def parse_patch_output(output_line):
+def parsepatchoutput(output_line):
     """parses the output produced by patch and returns the filename"""
     pf = output_line[14:]
     if pf[0] == '`':
@@ -87,7 +87,7 @@
     args = user and ("%s@%s" % (user, host)) or host
     return port and ("%s %s %s" % (args, pflag, port)) or args
 
-def set_flags(f, l, x):
+def setflags(f, l, x):
     pass
 
 def checkexec(path):
@@ -96,7 +96,7 @@
 def checklink(path):
     return False
 
-def set_binary(fd):
+def setbinary(fd):
     # When run without console, pipes may expose invalid
     # fileno(), usually set to -1.
     if hasattr(fd, 'fileno') and fd.fileno() >= 0:
@@ -155,7 +155,7 @@
     command += " 2> %s" % nulldev
     return os.popen(quotecommand(command), mode)
 
-def explain_exit(code):
+def explainexit(code):
     return _("exited with status %d") % code, code
 
 # if you change this stub into a real check, please try to implement the