Mercurial > hgsubversion
changeset 759:864b5b67a5f0
svnexternals: keep diff() simple for the caller, return a list
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 19 Nov 2010 17:07:13 +0100 |
parents | 76ebfc41f490 |
children | bf1c27a89c76 |
files | hgsubversion/pushmod.py hgsubversion/svnexternals.py |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/pushmod.py +++ b/hgsubversion/pushmod.py @@ -97,8 +97,8 @@ def commit(ui, repo, rev_ctx, meta, base elif parent_branch and parent_branch != 'default': branch_path = 'branches/%s' % parent_branch - extchanges = list(svnexternals.diff(svnexternals.parse(parent), - svnexternals.parse(rev_ctx))) + extchanges = svnexternals.diff(svnexternals.parse(parent), + svnexternals.parse(rev_ctx)) addeddirs, deleteddirs = _getdirchanges(svn, branch_path, parent, rev_ctx, rev_ctx.files(), extchanges) deleteddirs = set(deleteddirs)
--- a/hgsubversion/svnexternals.py +++ b/hgsubversion/svnexternals.py @@ -61,18 +61,20 @@ class externalsfile(dict): self.setdefault(target, []).append(line[1:]) def diff(ext1, ext2): - """Compare 2 externalsfile and yield tuples like (dir, value1, value2) - where value1 is the external value in ext1 for dir or None, and - value2 the same in ext2. + """Compare 2 externalsfile and return a list of tuples like (dir, + value1, value2) where value1 is the external value in ext1 for dir + or None, and value2 the same in ext2. """ + changes = [] for d in ext1: if d not in ext2: - yield d, '\n'.join(ext1[d]), None + changes.append((d, '\n'.join(ext1[d]), None)) elif ext1[d] != ext2[d]: - yield d, '\n'.join(ext1[d]), '\n'.join(ext2[d]) + changes.append((d, '\n'.join(ext1[d]), '\n'.join(ext2[d]))) for d in ext2: if d not in ext1: - yield d, None, '\n'.join(ext2[d]) + changes.append((d, None, '\n'.join(ext2[d]))) + return changes class BadDefinition(Exception): pass