Mercurial > public > mercurial-scm > hg-stable
diff mercurial/patch.py @ 24385:885a573fa619
patch.pathtransform: prepend prefix even if strip is 0
Silly oversight by me.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 18 Mar 2015 20:59:06 -0700 |
parents | 8a997bd73448 |
children | 72d7d390ef5d |
line wrap: on
line diff
--- a/mercurial/patch.py Tue Oct 28 22:32:18 2014 -0700 +++ b/mercurial/patch.py Wed Mar 18 20:59:06 2015 -0700 @@ -1465,6 +1465,8 @@ ('', ' a/b/c') >>> pathtransform(' a/b/c ', 2, '') ('a/b/', 'c') + >>> pathtransform('a/b/c', 0, 'd/e/') + ('', 'd/e/a/b/c') >>> pathtransform(' a//b/c ', 2, 'd/e/') ('a//b/', 'd/e/c') >>> pathtransform('a/b/c', 3, '') @@ -1474,7 +1476,7 @@ pathlen = len(path) i = 0 if strip == 0: - return '', path.rstrip() + return '', prefix + path.rstrip() count = strip while count > 0: i = path.find('/', i)