annotate tests/test-impexp-branch.t @ 14050:9e8a9d45945c stable

subrepo: handle svn tracked/unknown directory collisions This happens more often than expected. Say you have an svn subrepository with python code. Python would have generated unknown .pyc files. Now, you rebase this setup on a revision where a directory containing python code does not exist. Subversion is first asked to remove this directory when updating, but will not because it contains untracked items. Then it will have to bring back the directory after the merge but will fail because it now collides with an untracked directory. Using --force is not very elegant and only works with svn >= 1.5 but the only alternative I can think of is to write our own purge command for subversion.
author Patrick Mezard <pmezard@gmail.com>
date Fri, 04 Mar 2011 14:00:49 +0100
parents 46ab8c5dd99a
children fbbe9239574a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12119
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
1 $ cat >findbranch.py <<EOF
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
2 > import re, sys
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
3 >
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
4 > head_re = re.compile('^#(?:(?:\\s+([A-Za-z][A-Za-z0-9_]*)(?:\\s.*)?)|(?:\\s*))$')
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
5 >
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
6 > for line in sys.stdin:
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
7 > hmatch = head_re.match(line)
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
8 > if not hmatch:
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
9 > sys.exit(1)
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
10 > if hmatch.group(1) == 'Branch':
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
11 > sys.exit(0)
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
12 > sys.exit(1)
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
13 > EOF
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
14 $ hg init a
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
15 $ cd a
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
16 $ echo "Rev 1" >rev
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
17 $ hg add rev
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
18 $ hg commit -m "No branch."
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
19 $ hg branch abranch
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
20 marked working directory as branch abranch
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
21 $ echo "Rev 2" >rev
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
22 $ hg commit -m "With branch."
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
23 $ if hg export 0 | python ../findbranch.py; then
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
24 > echo "Export of default branch revision has Branch header" 1>&2
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
25 > exit 1
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
26 > fi
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
27 $ if hg export 1 | python ../findbranch.py; then
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
28 > : # Do nothing
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
29 > else
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
30 > echo "Export of branch revision is missing Branch header" 1>&2
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
31 > exit 1
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
32 > fi
4442
871ff96a86cc Add a test for the Branch header being in hg export.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
33
12119
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
34 Make sure import still works with branch information in patches.
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
35
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
36 $ cd ..
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
37 $ hg init b
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
38 $ cd b
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
39 $ hg -R ../a export 0 | hg import -
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
40 applying patch from stdin
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
41 $ hg -R ../a export 1 | hg import -
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
42 applying patch from stdin
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
43 $ cd ..
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
44 $ rm -rf b
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
45 $ hg init b
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
46 $ cd b
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
47 $ hg -R ../a export 0 | hg import --exact -
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
48 applying patch from stdin
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
49 $ hg -R ../a export 1 | hg import --exact -
46ab8c5dd99a tests: unify test-impexp-branch
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4444
diff changeset
50 applying patch from stdin