comparison hgext/mq.py @ 14396:170747a3e139

mq: strip all leading slashes from url when importing When trying to import a url that ends with a slash os.path.basename() would return an empty string. So when seeing a leading slash, remove it and infer the patch name from the remaining url. e.g. `hg qimport http://paste.pocoo.org/raw/xxx/` deduced '.' to be the patch name. Now we'll deduce 'xxx'.
author Idan Kamara <idankk86@gmail.com>
date Fri, 20 May 2011 21:20:24 +0300
parents dc961471efde
children 2e77525e52d9
comparison
equal deleted inserted replaced
14395:dc961471efde 14396:170747a3e139
1830 1830
1831 else: 1831 else:
1832 if filename == '-' and not patchname: 1832 if filename == '-' and not patchname:
1833 raise util.Abort(_('need --name to import a patch from -')) 1833 raise util.Abort(_('need --name to import a patch from -'))
1834 elif not patchname: 1834 elif not patchname:
1835 patchname = normname(os.path.basename(filename)) 1835 patchname = normname(os.path.basename(filename.rstrip('/')))
1836 self.check_reserved_name(patchname) 1836 self.check_reserved_name(patchname)
1837 checkfile(patchname) 1837 checkfile(patchname)
1838 try: 1838 try:
1839 if filename == '-': 1839 if filename == '-':
1840 text = sys.stdin.read() 1840 text = sys.stdin.read()