Show More
@@ -1465,6 +1465,8 b' def pathtransform(path, strip, prefix):' | |||
|
1465 | 1465 | ('', ' a/b/c') |
|
1466 | 1466 | >>> pathtransform(' a/b/c ', 2, '') |
|
1467 | 1467 | ('a/b/', 'c') |
|
1468 | >>> pathtransform('a/b/c', 0, 'd/e/') | |
|
1469 | ('', 'd/e/a/b/c') | |
|
1468 | 1470 | >>> pathtransform(' a//b/c ', 2, 'd/e/') |
|
1469 | 1471 | ('a//b/', 'd/e/c') |
|
1470 | 1472 | >>> pathtransform('a/b/c', 3, '') |
@@ -1474,7 +1476,7 b' def pathtransform(path, strip, prefix):' | |||
|
1474 | 1476 | pathlen = len(path) |
|
1475 | 1477 | i = 0 |
|
1476 | 1478 | if strip == 0: |
|
1477 | return '', path.rstrip() | |
|
1479 | return '', prefix + path.rstrip() | |
|
1478 | 1480 | count = strip |
|
1479 | 1481 | while count > 0: |
|
1480 | 1482 | i = path.find('/', i) |
@@ -626,6 +626,29 b' Prefix with strip, renames, creates etc' | |||
|
626 | 626 | adding dir/d |
|
627 | 627 | adding dir/dir2/b |
|
628 | 628 | adding dir/dir2/c |
|
629 | $ hg import --no-commit --prefix dir/ - <<EOF | |
|
630 | > diff --git a/a b/a | |
|
631 | > --- /dev/null | |
|
632 | > +++ b/a | |
|
633 | > @@ -0,0 +1 @@ | |
|
634 | > +aaa | |
|
635 | > diff --git a/d b/d | |
|
636 | > --- a/d | |
|
637 | > +++ b/d | |
|
638 | > @@ -1,1 +1,2 @@ | |
|
639 | > d | |
|
640 | > +dd | |
|
641 | > EOF | |
|
642 | applying patch from stdin | |
|
643 | $ cat dir/a | |
|
644 | aaa | |
|
645 | $ cat dir/d | |
|
646 | d | |
|
647 | dd | |
|
648 | $ hg revert -aC | |
|
649 | forgetting dir/a (glob) | |
|
650 | reverting dir/d (glob) | |
|
651 | $ rm dir/a | |
|
629 | 652 | (test that prefixes are relative to the root) |
|
630 | 653 | $ mkdir tmpdir |
|
631 | 654 | $ cd tmpdir |
General Comments 0
You need to be logged in to leave comments.
Login now