[PATCH 5 of 5] pathutil: use temporary variables instead of complicated wrapping

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Dec 3 16:01:29 CST 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1449177260 28800
#      Thu Dec 03 13:14:20 2015 -0800
# Node ID 3bab3ad5eff0cf16c241aaea5958c53920aa3158
# Parent  65797f84a2cc0317f1326215701befd382d04299
# EXP-Topic symlink.issue4749
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 3bab3ad5eff0
pathutil: use temporary variables instead of complicated wrapping

The one-lining did not help readability, we get rid of it.

diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py
--- a/mercurial/pathutil.py
+++ b/mercurial/pathutil.py
@@ -109,18 +109,17 @@ class pathauditor(object):
             # They must be ignored for patterns can be checked too.
             if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
                 raise
         else:
             if stat.S_ISLNK(st.st_mode):
-                raise error.Abort(
-                    _('path %r traverses symbolic link %r')
-                    % (path, prefix))
+                msg = _('path %r traverses symbolic link %r') % (path, prefix)
+                raise error.Abort(msg)
             elif (stat.S_ISDIR(st.st_mode) and
                   os.path.isdir(os.path.join(curpath, '.hg'))):
                 if not self.callback or not self.callback(curpath):
-                    raise error.Abort(_("path '%s' is inside nested "
-                                        "repo %r") % (path, prefix))
+                    msg = _("path '%s' is inside nested repo %r")
+                    raise error.Abort(msg % (path, prefix))
 
     def check(self, path):
         try:
             self(path)
             return True


More information about the Mercurial-devel mailing list