Show More
@@ -1465,6 +1465,8 b' def pathtransform(path, strip, prefix):' | |||||
1465 | ('', ' a/b/c') |
|
1465 | ('', ' a/b/c') | |
1466 | >>> pathtransform(' a/b/c ', 2, '') |
|
1466 | >>> pathtransform(' a/b/c ', 2, '') | |
1467 | ('a/b/', 'c') |
|
1467 | ('a/b/', 'c') | |
|
1468 | >>> pathtransform('a/b/c', 0, 'd/e/') | |||
|
1469 | ('', 'd/e/a/b/c') | |||
1468 | >>> pathtransform(' a//b/c ', 2, 'd/e/') |
|
1470 | >>> pathtransform(' a//b/c ', 2, 'd/e/') | |
1469 | ('a//b/', 'd/e/c') |
|
1471 | ('a//b/', 'd/e/c') | |
1470 | >>> pathtransform('a/b/c', 3, '') |
|
1472 | >>> pathtransform('a/b/c', 3, '') | |
@@ -1474,7 +1476,7 b' def pathtransform(path, strip, prefix):' | |||||
1474 | pathlen = len(path) |
|
1476 | pathlen = len(path) | |
1475 | i = 0 |
|
1477 | i = 0 | |
1476 | if strip == 0: |
|
1478 | if strip == 0: | |
1477 | return '', path.rstrip() |
|
1479 | return '', prefix + path.rstrip() | |
1478 | count = strip |
|
1480 | count = strip | |
1479 | while count > 0: |
|
1481 | while count > 0: | |
1480 | i = path.find('/', i) |
|
1482 | i = path.find('/', i) |
@@ -626,6 +626,29 b' Prefix with strip, renames, creates etc' | |||||
626 | adding dir/d |
|
626 | adding dir/d | |
627 | adding dir/dir2/b |
|
627 | adding dir/dir2/b | |
628 | adding dir/dir2/c |
|
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 | (test that prefixes are relative to the root) |
|
652 | (test that prefixes are relative to the root) | |
630 | $ mkdir tmpdir |
|
653 | $ mkdir tmpdir | |
631 | $ cd tmpdir |
|
654 | $ cd tmpdir |
General Comments 0
You need to be logged in to leave comments.
Login now