def file_changes(self, path, source, target):
Given two revisions and a path, yields the numbers of SVN commits which
- affected that file. Note that source = 5 will first look at changeset 6,
- since that starts with commit 5.
+ affected that file/directory. Note that source = 5 will first look at
+ changeset 6, since that starts with commit 5.
- def commit(self, branch_name, parent, message, author,
+ def commit(self, branch_name, parent, message, author, s):
"Commits a change to the repository."
# Work out the correct parent (i.e. go back till we hit the branch)
# The file wasn't in Mercurial before.
# Patch it with the svndiff (or mark as deleted)
- svndiff = svndiffs[path]
- # File was deleted. Tell hg that.
+ result = undiff(source, StringIO(changes[path]))
+ # No svndiff, so this is a deletion.
- result = undiff(source, StringIO(svndiff))
# Return that as a memfilectx
return memfilectx(path, result, False, False, None)
+ # Work out what to actually delete (some of the deleted paths may be
+ # directories; do prefix checks)
+ for path in self.hg_repo.changectx('tip'):
+ for delete_path in deletions:
+ if path.startswith(delete_path):
# Make the change context which represents this new commit
parents = [parent, None],
- files =
+ files = s.keys(),