changeset 34968:cabc840ffdee stable 4.4.1

stable: merge with security patches
author Augie Fackler <augie@google.com>
date Tue, 07 Nov 2017 11:22:24 -0500
parents 0f5521e56b77 (diff) 1a314176da9c (current diff)
children 929bf8390056
files mercurial/configitems.py
diffstat 5 files changed, 52 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/share.py	Mon Nov 06 22:32:41 2017 -0800
+++ b/hgext/share.py	Tue Nov 07 11:22:24 2017 -0500
@@ -63,16 +63,6 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
-configtable = {}
-configitem = registrar.configitem(configtable)
-
-configitem('share', 'pool',
-    default=None,
-)
-configitem('share', 'poolnaming',
-    default='identity',
-)
-
 @command('share',
     [('U', 'noupdate', None, _('do not create a working directory')),
      ('B', 'bookmarks', None, _('also share bookmarks')),
--- a/mercurial/cmdutil.py	Mon Nov 06 22:32:41 2017 -0800
+++ b/mercurial/cmdutil.py	Tue Nov 07 11:22:24 2017 -0500
@@ -570,9 +570,8 @@
     unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
     if unresolvedlist:
         mergeliststr = '\n'.join(
-            ['    %s' % os.path.relpath(
-                os.path.join(repo.root, path),
-                pycompat.getcwd()) for path in unresolvedlist])
+            ['    %s' % util.pathto(repo.root, pycompat.getcwd(), path)
+             for path in unresolvedlist])
         msg = _('''Unresolved merge conflicts:
 
 %s
--- a/mercurial/configitems.py	Mon Nov 06 22:32:41 2017 -0800
+++ b/mercurial/configitems.py	Tue Nov 07 11:22:24 2017 -0500
@@ -790,6 +790,12 @@
 coreconfigitem('server', 'zliblevel',
     default=-1,
 )
+coreconfigitem('share', 'pool',
+    default=None,
+)
+coreconfigitem('share', 'poolnaming',
+    default='identity',
+)
 coreconfigitem('smtp', 'host',
     default=None,
 )
--- a/mercurial/hg.py	Mon Nov 06 22:32:41 2017 -0800
+++ b/mercurial/hg.py	Tue Nov 07 11:22:24 2017 -0500
@@ -243,7 +243,9 @@
         try:
             sharedpath = os.path.relpath(sharedpath, destvfs.base)
             requirements += 'relshared\n'
-        except IOError as e:
+        except (IOError, ValueError) as e:
+            # ValueError is raised on Windows if the drive letters differ on
+            # each path
             raise error.Abort(_('cannot calculate relative path'),
                               hint=str(e))
     else:
--- a/mercurial/pathutil.py	Mon Nov 06 22:32:41 2017 -0800
+++ b/mercurial/pathutil.py	Tue Nov 07 11:22:24 2017 -0500
@@ -135,7 +135,47 @@
             return False
 
 def canonpath(root, cwd, myname, auditor=None):
-    '''return the canonical path of myname, given cwd and root'''
+    '''return the canonical path of myname, given cwd and root
+
+    >>> def check(root, cwd, myname):
+    ...     a = pathauditor(root, realfs=False)
+    ...     try:
+    ...         return canonpath(root, cwd, myname, a)
+    ...     except error.Abort:
+    ...         return 'aborted'
+    >>> def unixonly(root, cwd, myname, expected='aborted'):
+    ...     if pycompat.iswindows:
+    ...         return expected
+    ...     return check(root, cwd, myname)
+    >>> def winonly(root, cwd, myname, expected='aborted'):
+    ...     if not pycompat.iswindows:
+    ...         return expected
+    ...     return check(root, cwd, myname)
+    >>> winonly(b'd:\\\\repo', b'c:\\\\dir', b'filename')
+    'aborted'
+    >>> winonly(b'c:\\\\repo', b'c:\\\\dir', b'filename')
+    'aborted'
+    >>> winonly(b'c:\\\\repo', b'c:\\\\', b'filename')
+    'aborted'
+    >>> winonly(b'c:\\\\repo', b'c:\\\\', b'repo\\\\filename',
+    ...         b'filename')
+    'filename'
+    >>> winonly(b'c:\\\\repo', b'c:\\\\repo', b'filename', b'filename')
+    'filename'
+    >>> winonly(b'c:\\\\repo', b'c:\\\\repo\\\\subdir', b'filename',
+    ...         b'subdir/filename')
+    'subdir/filename'
+    >>> unixonly(b'/repo', b'/dir', b'filename')
+    'aborted'
+    >>> unixonly(b'/repo', b'/', b'filename')
+    'aborted'
+    >>> unixonly(b'/repo', b'/', b'repo/filename', b'filename')
+    'filename'
+    >>> unixonly(b'/repo', b'/repo', b'filename', b'filename')
+    'filename'
+    >>> unixonly(b'/repo', b'/repo/subdir', b'filename', b'subdir/filename')
+    'subdir/filename'
+    '''
     if util.endswithsep(root):
         rootsep = root
     else: