largefiles: don't crash when trying to find default dest for url without path stable
authorMads Kiilerich <madski@unity3d.com>
Mon, 04 Feb 2013 23:26:44 +0100
branchstable
changeset 18553 b6b9475c563a
parent 18552 e8efcc8ff5c0
child 18554 1516d5624a29
child 18555 b31e0be96c79
child 18577 0e7b072d58ed
largefiles: don't crash when trying to find default dest for url without path b32e55e6c3c7 introduced a crash when cloning a url without path - where util.url().path would be None. This None will now be handled as ''. clone will thus abort with 'repository / not found' as before.
mercurial/hg.py
tests/test-largefiles.t
--- a/mercurial/hg.py	Mon Feb 04 23:25:25 2013 +0100
+++ b/mercurial/hg.py	Mon Feb 04 23:26:44 2013 +0100
@@ -122,7 +122,7 @@
 
 def defaultdest(source):
     '''return default destination of clone if none is given'''
-    return os.path.basename(os.path.normpath(util.url(source).path))
+    return os.path.basename(os.path.normpath(util.url(source).path or ''))
 
 def share(ui, source, dest=None, update=True):
     '''create a shared repository'''
--- a/tests/test-largefiles.t	Mon Feb 04 23:25:25 2013 +0100
+++ b/tests/test-largefiles.t	Mon Feb 04 23:26:44 2013 +0100
@@ -831,6 +831,8 @@
   commit: (clean)
   update: 8 new changesets (update)
 
+Show computed destination directory:
+
   $ mkdir xyz
   $ cd xyz
   $ hg clone ../a
@@ -841,6 +843,12 @@
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd ..
 
+Clone URL without path:
+
+  $ hg clone file://
+  abort: repository / not found!
+  [255]
+
 Ensure base clone command argument validation
 
   $ hg clone -U -u 0 a a-clone-failure