# HG changeset patch # User Augie Fackler # Date 1255734593 14400 # Node ID cad864ed29de167cd4983010e899a1adffb8c5f1 # Parent 5e0dfe59d4c36a7b625df44a773b44184bbcf9af util: make aresamefiles take one file and just be issamefile instead. diff --git a/hgsubversion/editor.py b/hgsubversion/editor.py --- a/hgsubversion/editor.py +++ b/hgsubversion/editor.py @@ -218,7 +218,7 @@ class HgEditor(delta.Editor): branch) if parentid != revlog.nullid: parentctx = self.repo.changectx(parentid) - if util.aresamefiles(parentctx, ctx, [from_file]): + if util.issamefile(parentctx, ctx, from_file): self.current.copies[path] = from_file @ieditor @@ -279,7 +279,7 @@ class HgEditor(delta.Editor): if parentid != revlog.nullid: parentctx = self.repo.changectx(parentid) for k, v in copies.iteritems(): - if util.aresamefiles(parentctx, cp_f_ctx, [v]): + if util.issamefile(parentctx, cp_f_ctx, v): self.current.copies.update({k: v}) return path diff --git a/hgsubversion/stupid.py b/hgsubversion/stupid.py --- a/hgsubversion/stupid.py +++ b/hgsubversion/stupid.py @@ -323,7 +323,7 @@ def getcopies(svn, meta, branch, branchp if sourcectx is None: continue for k, v in copies: - if not util.aresamefiles(sourcectx, parentctx, [v]): + if not util.issamefile(sourcectx, parentctx, v): continue hgcopies.update({k: v}) return hgcopies diff --git a/hgsubversion/util.py b/hgsubversion/util.py --- a/hgsubversion/util.py +++ b/hgsubversion/util.py @@ -121,10 +121,8 @@ def swap_out_encoding(new_encoding="UTF- return old -def aresamefiles(parentctx, childctx, files): - """Assuming all files exist in childctx and parentctx, return True - if none of them was changed in-between. - """ +def issamefile(parentctx, childctx, f): + """Assuming f exists and is the same in childctx and parentctx, return True.""" if parentctx == childctx: return True if parentctx.rev() > childctx.rev(): @@ -135,12 +133,10 @@ def aresamefiles(parentctx, childctx, fi for ctx in selfctx.ancestors(): yield ctx - files = dict.fromkeys(files) for pctx in selfandancestors(childctx): if pctx.rev() <= parentctx.rev(): return True - for f in pctx.files(): - if f in files: - return False + if f in pctx.files(): + return False # parentctx is not an ancestor of childctx, files are unrelated return False