# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1376068784 -7200 # Node ID 131cb06dca76605925bd2cc403726fcda2b26e87 # Parent 04f15d38a500754d45dcbf84c898df8020c2a188 svnwrap & pushmod: return a Revision when committing diff --git a/hgsubversion/pushmod.py b/hgsubversion/pushmod.py --- a/hgsubversion/pushmod.py +++ b/hgsubversion/pushmod.py @@ -196,9 +196,9 @@ def commit(ui, repo, rev_ctx, meta, base if not new_target_files: raise NoFilesException() try: - svn.commit(new_target_files, rev_ctx.description(), file_data, - base_revision, set(addeddirs), set(deleteddirs), - props, newcopies) + return svn.commit(new_target_files, rev_ctx.description(), file_data, + base_revision, set(addeddirs), set(deleteddirs), + props, newcopies) except svnwrap.SubversionException, e: if len(e.args) > 0 and e.args[1] in (svnwrap.ERR_FS_TXN_OUT_OF_DATE, svnwrap.ERR_FS_CONFLICT, @@ -211,5 +211,3 @@ def commit(ui, repo, rev_ctx, meta, base raise hgutil.Abort(e.args[0]) else: raise - - return True diff --git a/hgsubversion/svnwrap/subvertpy_wrapper.py b/hgsubversion/svnwrap/subvertpy_wrapper.py --- a/hgsubversion/svnwrap/subvertpy_wrapper.py +++ b/hgsubversion/svnwrap/subvertpy_wrapper.py @@ -380,10 +380,14 @@ class SubversionRepo(object): def commit(self, paths, message, file_data, base_revision, addeddirs, deleteddirs, props, copies): """Commits the appropriate targets from revision in editor's store. + + Return the committed revision as a common.Revision instance. """ - def commitcb(*args): - commit_info.append(args) - commit_info = [] + def commitcb(rev, date, author): + r = common.Revision(rev, author, message, date) + committedrev.append(r) + + committedrev = [] revprops = { properties.PROP_REVISION_LOG: message } # revprops.update(props) commiteditor = self.remote.get_commit_editor(revprops, commitcb) @@ -464,6 +468,8 @@ class SubversionRepo(object): raise commiteditor.close() + return committedrev.pop() + def get_replay(self, revision, editor, oldestrev=0): try: diff --git a/hgsubversion/svnwrap/svn_swig_wrapper.py b/hgsubversion/svnwrap/svn_swig_wrapper.py --- a/hgsubversion/svnwrap/svn_swig_wrapper.py +++ b/hgsubversion/svnwrap/svn_swig_wrapper.py @@ -368,11 +368,20 @@ class SubversionRepo(object): def commit(self, paths, message, file_data, base_revision, addeddirs, deleteddirs, properties, copies): """Commits the appropriate targets from revision in editor's store. + + Return the committed revision as a common.Revision instance. """ self.init_ra_and_client() - commit_info = [] - def commit_cb(_commit_info, pool): - commit_info.append(_commit_info) + + def commit_cb(commit_info, pool): + # disregard commit_info.post_commit_err for now + r = common.Revision(commit_info.revision, commit_info.author, + message, commit_info.date) + + committedrev.append(r) + + committedrev = [] + editor, edit_baton = ra.get_commit_editor2(self.ra, message, commit_cb, @@ -446,6 +455,8 @@ class SubversionRepo(object): editor.close_edit(edit_baton, self.pool) + return committedrev.pop() + def get_replay(self, revision, editor, oldest_rev_i_have=0): # this method has a tendency to chew through RAM if you don't re-init self.init_ra_and_client()