comparison tests/test-import-git.t @ 24259:5ac8ce04baa2

cmdutil.tryimportone: allow importing relative patches into the working dir This makes hg import --prefix dir/ (without bypass) work.
author Siddharth Agarwal <sid0@fb.com>
date Mon, 09 Mar 2015 18:22:24 -0700
parents 7731a2281cf0
children 885a573fa619
comparison
equal deleted inserted replaced
24258:093e8a5e995f 24259:5ac8ce04baa2
610 $ hg st --copies 610 $ hg st --copies
611 A b 611 A b
612 a 612 a
613 R a 613 R a
614 614
615 Renames, similarity and git diff 615 Prefix with strip, renames, creates etc
616 616
617 $ hg revert -aC 617 $ hg revert -aC
618 undeleting a 618 undeleting a
619 forgetting b 619 forgetting b
620 $ rm b 620 $ rm b
621 $ mkdir -p dir/dir2
622 $ echo b > dir/dir2/b
623 $ echo c > dir/dir2/c
624 $ echo d > dir/d
625 $ hg ci -Am addbcd
626 adding dir/d
627 adding dir/dir2/b
628 adding dir/dir2/c
629 (test that prefixes are relative to the root)
630 $ mkdir tmpdir
631 $ cd tmpdir
632 $ hg import --no-commit -p2 --prefix dir/ - <<EOF
633 > diff --git a/foo/a b/foo/a
634 > new file mode 100644
635 > --- /dev/null
636 > +++ b/foo/a
637 > @@ -0,0 +1 @@
638 > +a
639 > diff --git a/foo/dir2/b b/foo/dir2/b2
640 > rename from foo/dir2/b
641 > rename to foo/dir2/b2
642 > diff --git a/foo/dir2/c b/foo/dir2/c
643 > --- a/foo/dir2/c
644 > +++ b/foo/dir2/c
645 > @@ -0,0 +1 @@
646 > +cc
647 > diff --git a/foo/d b/foo/d
648 > deleted file mode 100644
649 > --- a/foo/d
650 > +++ /dev/null
651 > @@ -1,1 +0,0 @@
652 > -d
653 > EOF
654 applying patch from stdin
655 $ hg st --copies
656 M dir/dir2/c
657 A dir/a
658 A dir/dir2/b2
659 dir/dir2/b
660 R dir/d
661 R dir/dir2/b
662 $ cd ..
663
664 Renames, similarity and git diff
665
666 $ hg revert -aC
667 forgetting dir/a (glob)
668 undeleting dir/d (glob)
669 undeleting dir/dir2/b (glob)
670 forgetting dir/dir2/b2 (glob)
671 reverting dir/dir2/c (glob)
672 $ rm dir/a dir/dir2/b2
621 $ hg import --similarity 90 --no-commit - <<EOF 673 $ hg import --similarity 90 --no-commit - <<EOF
622 > diff --git a/a b/b 674 > diff --git a/a b/b
623 > rename from a 675 > rename from a
624 > rename to b 676 > rename to b
625 > EOF 677 > EOF