##// END OF EJS Templates
tests: remove useless line wrapping in a code fragment embedded in test script...
FUJIWARA Katsunori -
r41986:9d38b4b5 default
parent child Browse files
Show More
@@ -1,133 +1,132 b''
1 # reproduce issue2264, issue2516
1 # reproduce issue2264, issue2516
2
2
3 create test repo
3 create test repo
4 $ cat <<EOF >> $HGRCPATH
4 $ cat <<EOF >> $HGRCPATH
5 > [extensions]
5 > [extensions]
6 > transplant =
6 > transplant =
7 > EOF
7 > EOF
8 $ hg init repo
8 $ hg init repo
9 $ cd repo
9 $ cd repo
10 $ template="{rev} {desc|firstline} [{branch}]\n"
10 $ template="{rev} {desc|firstline} [{branch}]\n"
11
11
12 # we need to start out with two changesets on the default branch
12 # we need to start out with two changesets on the default branch
13 # in order to avoid the cute little optimization where transplant
13 # in order to avoid the cute little optimization where transplant
14 # pulls rather than transplants
14 # pulls rather than transplants
15 add initial changesets
15 add initial changesets
16 $ echo feature1 > file1
16 $ echo feature1 > file1
17 $ hg ci -Am"feature 1"
17 $ hg ci -Am"feature 1"
18 adding file1
18 adding file1
19 $ echo feature2 >> file2
19 $ echo feature2 >> file2
20 $ hg ci -Am"feature 2"
20 $ hg ci -Am"feature 2"
21 adding file2
21 adding file2
22
22
23 # The changes to 'bugfix' are enough to show the bug: in fact, with only
23 # The changes to 'bugfix' are enough to show the bug: in fact, with only
24 # those changes, it's a very noisy crash ("RuntimeError: nothing
24 # those changes, it's a very noisy crash ("RuntimeError: nothing
25 # committed after transplant"). But if we modify a second file in the
25 # committed after transplant"). But if we modify a second file in the
26 # transplanted changesets, the bug is much more subtle: transplant
26 # transplanted changesets, the bug is much more subtle: transplant
27 # silently drops the second change to 'bugfix' on the floor, and we only
27 # silently drops the second change to 'bugfix' on the floor, and we only
28 # see it when we run 'hg status' after transplanting. Subtle data loss
28 # see it when we run 'hg status' after transplanting. Subtle data loss
29 # bugs are worse than crashes, so reproduce the subtle case here.
29 # bugs are worse than crashes, so reproduce the subtle case here.
30 commit bug fixes on bug fix branch
30 commit bug fixes on bug fix branch
31 $ hg branch fixes
31 $ hg branch fixes
32 marked working directory as branch fixes
32 marked working directory as branch fixes
33 (branches are permanent and global, did you want a bookmark?)
33 (branches are permanent and global, did you want a bookmark?)
34 $ echo fix1 > bugfix
34 $ echo fix1 > bugfix
35 $ echo fix1 >> file1
35 $ echo fix1 >> file1
36 $ hg ci -Am"fix 1"
36 $ hg ci -Am"fix 1"
37 adding bugfix
37 adding bugfix
38 $ echo fix2 > bugfix
38 $ echo fix2 > bugfix
39 $ echo fix2 >> file1
39 $ echo fix2 >> file1
40 $ hg ci -Am"fix 2"
40 $ hg ci -Am"fix 2"
41 $ hg log -G --template="$template"
41 $ hg log -G --template="$template"
42 @ 3 fix 2 [fixes]
42 @ 3 fix 2 [fixes]
43 |
43 |
44 o 2 fix 1 [fixes]
44 o 2 fix 1 [fixes]
45 |
45 |
46 o 1 feature 2 [default]
46 o 1 feature 2 [default]
47 |
47 |
48 o 0 feature 1 [default]
48 o 0 feature 1 [default]
49
49
50 transplant bug fixes onto release branch
50 transplant bug fixes onto release branch
51 $ hg update 0
51 $ hg update 0
52 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
52 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
53 $ hg branch release
53 $ hg branch release
54 marked working directory as branch release
54 marked working directory as branch release
55 $ hg transplant 2 3
55 $ hg transplant 2 3
56 applying [0-9a-f]{12} (re)
56 applying [0-9a-f]{12} (re)
57 [0-9a-f]{12} transplanted to [0-9a-f]{12} (re)
57 [0-9a-f]{12} transplanted to [0-9a-f]{12} (re)
58 applying [0-9a-f]{12} (re)
58 applying [0-9a-f]{12} (re)
59 [0-9a-f]{12} transplanted to [0-9a-f]{12} (re)
59 [0-9a-f]{12} transplanted to [0-9a-f]{12} (re)
60 $ hg log -G --template="$template"
60 $ hg log -G --template="$template"
61 @ 5 fix 2 [release]
61 @ 5 fix 2 [release]
62 |
62 |
63 o 4 fix 1 [release]
63 o 4 fix 1 [release]
64 |
64 |
65 | o 3 fix 2 [fixes]
65 | o 3 fix 2 [fixes]
66 | |
66 | |
67 | o 2 fix 1 [fixes]
67 | o 2 fix 1 [fixes]
68 | |
68 | |
69 | o 1 feature 2 [default]
69 | o 1 feature 2 [default]
70 |/
70 |/
71 o 0 feature 1 [default]
71 o 0 feature 1 [default]
72
72
73 $ hg status
73 $ hg status
74 $ hg status --rev 0:4
74 $ hg status --rev 0:4
75 M file1
75 M file1
76 A bugfix
76 A bugfix
77 $ hg status --rev 4:5
77 $ hg status --rev 4:5
78 M bugfix
78 M bugfix
79 M file1
79 M file1
80
80
81 now test that we fixed the bug for all scripts/extensions
81 now test that we fixed the bug for all scripts/extensions
82 $ cat > $TESTTMP/committwice.py <<__EOF__
82 $ cat > $TESTTMP/committwice.py <<__EOF__
83 > import time
83 > import time
84 > from mercurial import hg, match, node, ui as uimod
84 > from mercurial import hg, match, node, ui as uimod
85 >
85 >
86 > def replacebyte(fn, b):
86 > def replacebyte(fn, b):
87 > f = open(fn, "rb+")
87 > f = open(fn, "rb+")
88 > f.seek(0, 0)
88 > f.seek(0, 0)
89 > f.write(b)
89 > f.write(b)
90 > f.close()
90 > f.close()
91 >
91 >
92 > def printfiles(repo, rev):
92 > def printfiles(repo, rev):
93 > repo.ui.status(b"revision %d files: [%s]\n"
93 > repo.ui.status(b"revision %d files: [%s]\n"
94 > % (rev, b', '.join(b"'%s'" % f
94 > % (rev, b', '.join(b"'%s'" % f
95 > for f in repo[rev].files())))
95 > for f in repo[rev].files())))
96 >
96 >
97 > repo = hg.repository(uimod.ui.load(), b'.')
97 > repo = hg.repository(uimod.ui.load(), b'.')
98 > assert len(repo) == 6, \
98 > assert len(repo) == 6, "initial: len(repo): %d, expected: 6" % len(repo)
99 > "initial: len(repo): %d, expected: 6" % len(repo)
100 >
99 >
101 > replacebyte(b"bugfix", b"u")
100 > replacebyte(b"bugfix", b"u")
102 > time.sleep(2)
101 > time.sleep(2)
103 > try:
102 > try:
104 > repo.ui.status(b"PRE: len(repo): %d\n" % len(repo))
103 > repo.ui.status(b"PRE: len(repo): %d\n" % len(repo))
105 > wlock = repo.wlock()
104 > wlock = repo.wlock()
106 > lock = repo.lock()
105 > lock = repo.lock()
107 > replacebyte(b"file1", b"x")
106 > replacebyte(b"file1", b"x")
108 > repo.commit(text=b"x", user=b"test", date=(0, 0))
107 > repo.commit(text=b"x", user=b"test", date=(0, 0))
109 > replacebyte(b"file1", b"y")
108 > replacebyte(b"file1", b"y")
110 > repo.commit(text=b"y", user=b"test", date=(0, 0))
109 > repo.commit(text=b"y", user=b"test", date=(0, 0))
111 > repo.ui.status(b"POST: len(repo): %d\n" % len(repo))
110 > repo.ui.status(b"POST: len(repo): %d\n" % len(repo))
112 > finally:
111 > finally:
113 > lock.release()
112 > lock.release()
114 > wlock.release()
113 > wlock.release()
115 > printfiles(repo, 6)
114 > printfiles(repo, 6)
116 > printfiles(repo, 7)
115 > printfiles(repo, 7)
117 > __EOF__
116 > __EOF__
118 $ "$PYTHON" $TESTTMP/committwice.py
117 $ "$PYTHON" $TESTTMP/committwice.py
119 PRE: len(repo): 6
118 PRE: len(repo): 6
120 POST: len(repo): 8
119 POST: len(repo): 8
121 revision 6 files: ['bugfix', 'file1']
120 revision 6 files: ['bugfix', 'file1']
122 revision 7 files: ['file1']
121 revision 7 files: ['file1']
123
122
124 Do a size-preserving modification outside of that process
123 Do a size-preserving modification outside of that process
125 $ echo abcd > bugfix
124 $ echo abcd > bugfix
126 $ hg status
125 $ hg status
127 M bugfix
126 M bugfix
128 $ hg log --template "{rev} {desc} {files}\n" -r5:
127 $ hg log --template "{rev} {desc} {files}\n" -r5:
129 5 fix 2 bugfix file1
128 5 fix 2 bugfix file1
130 6 x bugfix file1
129 6 x bugfix file1
131 7 y file1
130 7 y file1
132
131
133 $ cd ..
132 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now