# # # patch "tracvc/mtn/backend.py" # from [17f6738d2440707aa7abaaaae1a5016054c11955] # to [ccfe47b5aa6ff822fbddcffc71b74fe2a4bd8d4a] # ============================================================ --- tracvc/mtn/backend.py 17f6738d2440707aa7abaaaae1a5016054c11955 +++ tracvc/mtn/backend.py ccfe47b5aa6ff822fbddcffc71b74fe2a4bd8d4a @@ -450,31 +450,38 @@ class MonotoneChangeset(Changeset): self.revpropspec = revpropspec or {} def get_changes(self): + """Generator that produces a tuple for every change in the changeset + + The tuple will contain `(path, kind, change, base_path, base_rev)`, + where `change` can be one of Changeset.ADD, Changeset.COPY, + Changeset.DELETE, Changeset.EDIT or Changeset.MOVE, + and `kind` is one of Node.FILE or Node.DIRECTORY. + The `path` is the targeted path for the `change` (which is + the ''deleted'' path for a DELETE change). + The `base_path` and `base_rev` are the source path and rev for the + action (`None` and `-1` in the case of an ADD change). """ - Generator that produces a (path, kind, change, base_path, base_rev) - tuple for every change in the changeset, where change can be one of - Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or - Changeset.MOVE, and kind is one of Node.FILE or Node.DIRECTORY. - """ + # We do not closely implement that api, for example, we don't + # know the kind of a deleted or renamed node. for cs in self.mtn.changesets(self.rev): oldrev = cs.oldrev # deletions for oldpath in cs.deleted: - yield oldpath, None, 'delete', oldpath, oldrev + yield oldpath, None, Changeset.DELETE, oldpath, oldrev # pure renames for (path, oldpath) in cs.renamed.iteritems(): - yield path, None, 'move', oldpath, oldrev + yield path, None, Changeset.MOVE, oldpath, oldrev # additions for (path, kind) in cs.added.iteritems(): - yield path, kind, 'add', None, oldrev + yield path, kind, Changeset.ADD, None, -1 # patches for path in cs.patched: oldpath = util.get_oldpath(path, cs.renamed) - yield path, 'file', 'edit', oldpath, oldrev + yield path, Node.FILE, Changeset.EDIT, oldpath, oldrev def get_properties(self): """Generator that provides additional metadata for this changeset.