Mercurial > hgsubversion
changeset 368:e786253eb565
Abstract out a branchedits() function.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Fri, 29 May 2009 11:45:08 +0200 |
parents | ce64d57172a3 |
children | ce2b7ef74f89 |
files | hgsubversion/hg_delta_editor.py hgsubversion/stupid.py |
diffstat | 2 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/hg_delta_editor.py +++ b/hgsubversion/hg_delta_editor.py @@ -612,6 +612,10 @@ class HgChangeReceiver(delta.Editor): else: self.delete_file(path) + def branchedits(self, branch, rev): + check = lambda x: x[0][1] == branch and x[0][0] < rev.revnum + return sorted(filter(check, self.revmap.iteritems()), reverse=True) + def commit_current_delta(self, tbdelta): if hasattr(self, '_exception_info'): #pragma: no cover traceback.print_exception(*self._exception_info) @@ -645,8 +649,7 @@ class HgChangeReceiver(delta.Editor): closed = revlog.nullid if 'closed-branches' in self.repo.branchtags(): closed = self.repo['closed-branches'].node() - branchedits = sorted(filter(lambda x: x[0][1] == branch and x[0][0] < rev.revnum, - self.revmap.iteritems()), reverse=True) + branchedits = self.branchedits(branch, rev) if len(branchedits) < 1: # can't close a branch that never existed continue
--- a/hgsubversion/stupid.py +++ b/hgsubversion/stupid.py @@ -458,8 +458,7 @@ def convert_rev(ui, hg_editor, svn, r, t continue branch = hg_editor._localname(p) if r.paths[p].action == 'R' and branch in hg_editor.branches: - branchedits = sorted(filter(lambda x: x[0][1] == branch and x[0][0] < r.revnum, - hg_editor.revmap.iteritems()), reverse=True) + branchedits = hg_editor.branchedits(branch, r) is_closed = False if len(branchedits) > 0: branchtip = branchedits[0][1] @@ -539,8 +538,7 @@ def convert_rev(ui, hg_editor, svn, r, t # These are branches which would have an 'R' status in svn log. This means they were # replaced by some other branch, so we need to verify they get marked as closed. for branch in check_deleted_branches: - branchedits = sorted(filter(lambda x: x[0][1] == branch and x[0][0] < r.revnum, - hg_editor.revmap.iteritems()), reverse=True) + branchedits = hg_editor.branchedits(branch, r) is_closed = False if len(branchedits) > 0: branchtip = branchedits[0][1]