Mercurial > hgsubversion
annotate tests/fixtures/commit-to-tag.sh @ 717:ae5968ffe6fe
svnwrap: fix handling of quotable URLs (fixes #197, refs #132)
The way hgsubversion handles URLs that may or may not be quoted is
somewhat fragile. As part of fixing issue 132 in 925ff8c5989c, the
path component of URLs was always quoted. The URL has been attempted
encoded since the initial check-in.
The fix from 925ff8c5989c was incomplete; reverting it allows us to
clone a URL with a '~' in it.[1] Encoding the URL as UTF-8 seldom
works as expected, as the default string encoding is ASCII, causing
Python to be unable to decode any URL containing an 8-bit
character.
The core problem here is that we don't know whether the URL specified
by the user is quoted or not. Rather than trying to deal with this
ourselves, we pass the problem on to Subversion. Then, we obtain the
URL from the RA instance, where it is always quoted. (It's worth
noting that the editor interface, on the other hand, always deals with
unquoted paths...)
Thus, the following invariants should apply to SubversionRepo
attributes:
- svn_url and root will always be quoted.
- subdir will always be unquoted.
Tests are added that verify that it won't affect the conversion
whether a URL is specified in quoted or unquoted form. Furthermore, a
test fixture for this is added *twice*, so that we can thoroughly test
both quoted and unquoted URLs. I'm not adding a test dedicated to
tildes in URLs; it doesn't seem necessary.
[1] Such as <https://svn.kenai.com/svn/winsw~subversion>.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Mon, 04 Oct 2010 21:00:36 -0500 |
parents | 9e6499c415a9 |
children |
rev | line source |
---|---|
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
2 mkdir temp |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 cd temp |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
4 svnadmin create repo |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
5 REPOPATH="file://`pwd`/repo" |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 svn co $REPOPATH wc |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
7 cd wc |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
8 mkdir -p branches/magic trunk tags |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 svn add * |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
10 svn ci -m 'btt' |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 cd branches/magic |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
12 for a in alpha beta gamma; do |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
13 echo $a > $a |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
14 svn add $a |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 svn ci -m "Add file $a" |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 done |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
17 cd ../.. |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
18 svn up |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
19 svn cp $REPOPATH/branches/magic $REPOPATH/tags/will-edit -m 'Make tag to edit' |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
20 svn up |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
21 |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
22 cd branches/magic |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
23 for a in delta iota lambda; do |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
24 echo $a > $a |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
25 svn add $a |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
26 svn ci -m "Add file $a" |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 done |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
28 cd ../.. |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
29 |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
30 cd tags/will-edit |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
31 svn rm alpha |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
32 svn ci -m 'removed alpha on a tag. Moves tag, implicit branch.' |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 cd ../.. |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
34 |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
35 cd branches/magic |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
36 for a in omega; do |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
37 echo $a > $a |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
38 svn add $a |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
39 svn ci -m "Add file $a" |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
40 done |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
41 cd ../.. |
449
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
42 svn up |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
43 svn cp $REPOPATH/branches/magic $REPOPATH/tags/also-edit -m 'Make tag to edit' |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
44 svn up |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
45 |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
46 echo not omega > branches/magic/omega |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
47 echo not omega > tags/also-edit/omega |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
48 svn ci -m 'edit both the tag and its source branch at the same time' |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
49 |
450
7ca49177991a
tags: Handle edits to edited tags.
Augie Fackler <durin42@gmail.com>
parents:
449
diff
changeset
|
50 echo more stupidity > tags/also-edit/omega |
7ca49177991a
tags: Handle edits to edited tags.
Augie Fackler <durin42@gmail.com>
parents:
449
diff
changeset
|
51 svn ci -m 'Edit an edited tag.' |
7ca49177991a
tags: Handle edits to edited tags.
Augie Fackler <durin42@gmail.com>
parents:
449
diff
changeset
|
52 |
451
e533e78f1b2f
tags: handle tags from edited tags.
Augie Fackler <durin42@gmail.com>
parents:
450
diff
changeset
|
53 svn cp $REPOPATH/tags/also-edit $REPOPATH/tags/did-edits -m 'Tag an edited tag' |
e533e78f1b2f
tags: handle tags from edited tags.
Augie Fackler <durin42@gmail.com>
parents:
450
diff
changeset
|
54 |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
55 svn cp $REPOPATH/branches/magic $REPOPATH/branches/closeme -m 'Make extra branch for another bogus case' |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
56 svn cp $REPOPATH/branches/closeme $REPOPATH/tags/edit-later -m 'Make tag to edit after branch closes' |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
57 svn rm $REPOPATH/branches/closeme -m 'Close the branch' |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
58 svn up |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
59 echo boofar > tags/edit-later/delta |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
60 svn ci -m 'Edit this tag after its parent closed' |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
61 |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
62 # try and revert will-edit to its original state |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
63 svn up |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
64 svn merge -r9:8 $REPOPATH . |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
65 svn ci -m 'Revert revision 9.' |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
66 |
547
9e6499c415a9
tags: fix files edited during tag creation
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
67 # make a tag from a branch and edit it at the same time |
9e6499c415a9
tags: fix files edited during tag creation
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
68 svn up |
9e6499c415a9
tags: fix files edited during tag creation
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
69 svn cp branches/magic tags/edit-at-create |
9e6499c415a9
tags: fix files edited during tag creation
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
70 echo alpha >> tags/edit-at-create/alpha |
9e6499c415a9
tags: fix files edited during tag creation
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
71 svn ci -m 'make a tag from a branch and edit it at the same time' |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
72 |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
73 cd ../.. |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
74 svnadmin dump temp/repo > commit-to-tag.svndump |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
75 echo |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
76 echo 'Complete.' |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
77 echo 'You probably want to clean up temp now.' |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
78 echo 'Dump in commit-to-tag.svndump' |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
79 exit 0 |