comparison tests/test_util.py @ 277:3848a7f9b983

push: Add a test that demonstrates base-text detection works
author Augie Fackler <durin42@gmail.com>
date Fri, 24 Apr 2009 20:31:17 -0500
parents 2848d17eae71
children 60acc38eac96
comparison
equal deleted inserted replaced
276:b45bae16be32 277:3848a7f9b983
138 raise Exception('svn ls failed on %s: %r' % (path, stderr)) 138 raise Exception('svn ls failed on %s: %r' % (path, stderr))
139 entries = [e.strip('/') for e in stdout.splitlines()] 139 entries = [e.strip('/') for e in stdout.splitlines()]
140 entries.sort() 140 entries.sort()
141 return entries 141 return entries
142 142
143 def commitchanges(self, changes): 143 def commitchanges(self, changes, parent='tip'):
144 """Commit changes to mercurial directory 144 """Commit changes to mercurial directory
145 145
146 'changes' is a sequence of tuples (source, dest, data). It can look 146 'changes' is a sequence of tuples (source, dest, data). It can look
147 like: 147 like:
148 - (source, source, data) to set source content to data 148 - (source, source, data) to set source content to data
151 - (source, dest, data) to set dest content to data, and mark it as copied 151 - (source, dest, data) to set dest content to data, and mark it as copied
152 from source. 152 from source.
153 - (source, None, None) to remove source. 153 - (source, None, None) to remove source.
154 """ 154 """
155 repo = self.repo 155 repo = self.repo
156 parentctx = repo['tip'] 156 parentctx = repo[parent]
157 157
158 changed, removed = [], [] 158 changed, removed = [], []
159 for source, dest, newdata in changes: 159 for source, dest, newdata in changes:
160 if dest is None: 160 if dest is None:
161 removed.append(source) 161 removed.append(source)
185 filectxfn, 185 filectxfn,
186 'an_author', 186 'an_author',
187 '2008-10-07 20:59:48 -0500') 187 '2008-10-07 20:59:48 -0500')
188 nodeid = repo.commitctx(ctx) 188 nodeid = repo.commitctx(ctx)
189 repo = self.repo 189 repo = self.repo
190 hg.update(repo, nodeid) 190 hg.clean(repo, nodeid)
191 return nodeid 191 return nodeid
192 192
193 def assertchanges(self, changes, ctx): 193 def assertchanges(self, changes, ctx):
194 """Assert that all 'changes' (as in defined in commitchanged()) 194 """Assert that all 'changes' (as in defined in commitchanged())
195 went into ctx. 195 went into ctx.