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