RE: [PATCH v2] remote-bzr: support the new 'force' option
flat view
From: Felipe Contreras <hidden>
Date: 2016-06-15 22:59:14
Richard Hansen wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Richard Hansen <redacted> --- This is a reroll of: http://article.gmane.org/gmane.comp.version-control.git/237607 based on feedback from Felipe: http://article.gmane.org/gmane.comp.version-control.git/237615 This patch is an optional extension to Felipe's "transport-helper: updates" patch series: http://thread.gmane.org/gmane.comp.version-control.git/237663 and it requires those changes to work. contrib/remote-helpers/git-remote-bzr | 32 +++++++++++++++++++++++++++++++- contrib/remote-helpers/test-bzr.sh | 22 +++++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-)diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr index 7e34532..2f481e9 100755 --- a/contrib/remote-helpers/git-remote-bzr +++ b/contrib/remote-helpers/git-remote-bzr@@ -42,6 +42,7 @@ import json import re import StringIO import atexit, shutil, hashlib, urlparse, subprocess +import types
No need for this any more.
quoted hunk ↗ jump to hunk
NAME_RE = re.compile('^([^<>]+)') AUTHOR_RE = re.compile('^([^<>]+?)? ?[<>]([^<>]*)(?:$|>)')@@ -684,7 +685,8 @@ def do_export(parser): peer = bzrlib.branch.Branch.open(peers[name], possible_transports=transports) try: - peer.bzrdir.push_branch(branch, revision_id=revid) + peer.bzrdir.push_branch(branch, revision_id=revid, + overwrite=force) except bzrlib.errors.DivergedBranches: print "error %s non-fast forward" % ref continue@@ -718,8 +720,32 @@ def do_capabilities(parser): print "*import-marks %s" % path print "*export-marks %s" % path + print "option" print +class InvalidOptionValue(Exception): + pass + +def get_bool_option(val): + if val == 'true': + return True + elif val == 'false': + return False + else: + raise InvalidOptionValue() + +def do_option(parser): + global force + (opt, val) = parser[1:3]
I prefer: opt, val = parser[1:3] But not a big deal. Otherwise the patch looks OK to me. -- Felipe Contreras