##// END OF EJS Templates
test-commit-multiple.t: improve committwice.py...
Adrian Buehlmann -
r13749:8bb03283 default
parent child Browse files
Show More
@@ -81,33 +81,43 b' transplant bug fixes onto release branch'
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 > from mercurial import ui, hg, match, node
83 > from mercurial import ui, hg, match, node
84 > from time import sleep
84 >
85 >
85 > def replacebyte(fn, b):
86 > def replacebyte(fn, b):
86 > f = open("file1", "rb+")
87 > f = open(fn, "rb+")
87 > f.seek(0, 0)
88 > f.seek(0, 0)
88 > f.write(b)
89 > f.write(b)
89 > f.close()
90 > f.close()
90 >
91 >
92 > def printfiles(repo, rev):
93 > print "revision %s files: %s" % (rev, repo[rev].files())
94 >
91 > repo = hg.repository(ui.ui(), '.')
95 > repo = hg.repository(ui.ui(), '.')
92 > assert len(repo) == 6, \
96 > assert len(repo) == 6, \
93 > "initial: len(repo) == %d, expected 6" % len(repo)
97 > "initial: len(repo): %d, expected: 6" % len(repo)
98 >
99 > replacebyte("bugfix", "u")
100 > sleep(2)
94 > try:
101 > try:
102 > print "PRE: len(repo): %d" % len(repo)
95 > wlock = repo.wlock()
103 > wlock = repo.wlock()
96 > lock = repo.lock()
104 > lock = repo.lock()
97 > m = match.exact(repo.root, '', ['file1'])
98 > replacebyte("file1", "x")
105 > replacebyte("file1", "x")
99 > n = repo.commit(text="x", user="test", date=(0, 0), match=m)
106 > repo.commit(text="x", user="test", date=(0, 0))
100 > print "commit 1: len(repo) == %d" % len(repo)
101 > replacebyte("file1", "y")
107 > replacebyte("file1", "y")
102 > n = repo.commit(text="y", user="test", date=(0, 0), match=m)
108 > repo.commit(text="y", user="test", date=(0, 0))
103 > print "commit 2: len(repo) == %d" % len(repo)
109 > print "POST: len(repo): %d" % len(repo)
104 > finally:
110 > finally:
105 > lock.release()
111 > lock.release()
106 > wlock.release()
112 > wlock.release()
113 > printfiles(repo, 6)
114 > printfiles(repo, 7)
107 > __EOF__
115 > __EOF__
108 $ $PYTHON $TESTTMP/committwice.py
116 $ $PYTHON $TESTTMP/committwice.py
109 commit 1: len(repo) == 7
117 PRE: len(repo): 6
110 commit 2: len(repo) == 8
118 POST: len(repo): 8
119 revision 6 files: ['bugfix', 'file1']
120 revision 7 files: ['file1']
111
121
112 Do a size-preserving modification outside of that process
122 Do a size-preserving modification outside of that process
113 $ echo abcd > bugfix
123 $ echo abcd > bugfix
@@ -115,5 +125,5 b' Do a size-preserving modification outsid'
115 M bugfix
125 M bugfix
116 $ hg log --template "{rev} {desc} {files}\n" -r5:
126 $ hg log --template "{rev} {desc} {files}\n" -r5:
117 5 fix 2 bugfix file1
127 5 fix 2 bugfix file1
118 6 x file1
128 6 x bugfix file1
119 7 y file1
129 7 y file1
General Comments 0
You need to be logged in to leave comments. Login now