# HG changeset patch # User Dirkjan Ochtman # Date 1243497448 -7200 # Node ID b71c8f9357402a3e74b13ef269a6503eb1b14996 # Parent ccef78b91ac922fee090f3c05c7d405766359dcc Move HgChangeReceiver.aresamefiles() to before the editor methods. diff --git a/hgsubversion/hg_delta_editor.py b/hgsubversion/hg_delta_editor.py --- a/hgsubversion/hg_delta_editor.py +++ b/hgsubversion/hg_delta_editor.py @@ -865,6 +865,32 @@ class HgChangeReceiver(delta.Editor): else: self.missing_plaintexts.add(svnpath) + def aresamefiles(self, parentctx, childctx, files): + """Assuming all files exist in childctx and parentctx, return True + if none of them was changed in-between. + """ + if parentctx == childctx: + return True + if parentctx.rev() > childctx.rev(): + parentctx, childctx = childctx, parentctx + + def selfandancestors(selfctx): + yield selfctx + 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 + # parentctx is not an ancestor of childctx, files are unrelated + return False + + # Here come all the actual editor methods + @ieditor def delete_entry(self, path, revision_bogus, parent_baton, pool=None): br_path, branch = self._path_and_branch_for_path(path) @@ -909,30 +935,6 @@ class HgChangeReceiver(delta.Editor): else: self.ui.debug('WARNING: Opening non-existant file %s\n' % path) - def aresamefiles(self, parentctx, childctx, files): - """Assuming all files exist in childctx and parentctx, return True - if none of them was changed in-between. - """ - if parentctx == childctx: - return True - if parentctx.rev() > childctx.rev(): - parentctx, childctx = childctx, parentctx - - def selfandancestors(selfctx): - yield selfctx - 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 - # parentctx is not an ancestor of childctx, files are unrelated - return False - @ieditor def add_file(self, path, parent_baton=None, copyfrom_path=None, copyfrom_revision=None, file_pool=None):