| 1 | #!/usr/bin/env python3 |
| 2 | ## Test handling of vendor branches |
| 3 | # |
| 4 | # This test was swiped from the git 1.8.1 tree, then modified to exercise |
| 5 | # lifters directly rather than through git-cvsimport. |
| 6 | # |
| 7 | # Description of the files in the repository: |
| 8 | # |
| 9 | # imported-once.txt: |
| 10 | # |
| 11 | # Imported once. 1.1 and 1.1.1.1 should be identical. |
| 12 | # |
| 13 | # imported-twice.txt: |
| 14 | # |
| 15 | # Imported twice. HEAD should reflect the contents of the |
| 16 | # second import (i.e., have the same contents as 1.1.1.2). |
| 17 | # |
| 18 | # imported-modified.txt: |
| 19 | # |
| 20 | # Imported, then modified on HEAD. HEAD should reflect the |
| 21 | # modification. |
| 22 | # |
| 23 | # imported-modified-imported.txt: |
| 24 | # |
| 25 | # Imported, then modified on HEAD, then imported again. |
| 26 | # |
| 27 | # added-imported.txt,v: |
| 28 | # |
| 29 | # Added with 'cvs add' to create 1.1, then imported with |
| 30 | # completely different contents to create 1.1.1.1, therefore the |
| 31 | # vendor branch was never the default branch. |
| 32 | # |
| 33 | # imported-anonymously.txt: |
| 34 | # |
| 35 | # Like imported-twice.txt, but with a vendor branch whose branch |
| 36 | # tag has been removed. |
| 37 | # |
| 38 | # Note: Without the -t 0 option this test has intermittent failures. |
| 39 | # This is due to commits with identical timestamps |
| 40 | # being canonicalized backwards from their topo order. |
| 41 | |
| 42 | import sys, testlifter |
| 43 | |
| 44 | testlifter.verbose += sys.argv[1:].count("-v") |
| 45 | repo = testlifter.CVSRepository("t9601.testrepo") |
| 46 | co = repo.checkout("module", "t9601.checkout") |
| 47 | repo.convert("module", "t9601.git", more_opts="-t 0") |
| 48 | |
| 49 | # Check a file that was imported once |
| 50 | testlifter.expect_same("t9601.checkout/imported-once.txt", |
| 51 | "t9601.git/imported-once.txt") |
| 52 | |
| 53 | # Check a file that was imported twice |
| 54 | testlifter.expect_same("t9601.checkout/imported-twice.txt", |
| 55 | "t9601.git/imported-twice.txt") |
| 56 | |
| 57 | # Check a file that was imported then modified on HEAD |
| 58 | testlifter.expect_same("t9601.checkout/imported-modified.txt", |
| 59 | "t9601.git/imported-modified.txt") |
| 60 | |
| 61 | # Check a file that was imported, modified, then imported |
| 62 | testlifter.expect_same("t9601.checkout/imported-modified-imported.txt", |
| 63 | "t9601.git/imported-modified-imported.txt") |
| 64 | |
| 65 | # Check a file that was added to HEAD then imported |
| 66 | testlifter.expect_same("t9601.checkout/added-imported.txt", |
| 67 | "t9601.git/added-imported.txt") |
| 68 | |
| 69 | # A vendor branch whose tag has been removed |
| 70 | testlifter.expect_same("t9601.checkout/imported-anonymously.txt", |
| 71 | "t9601.git/imported-anonymously.txt") |
| 72 | |
| 73 | co.cleanup() |