Merge "Stop setting a default topic on new changes"
This commit is contained in:
@@ -54,7 +54,7 @@ GLOBAL_CONFIG = "/etc/git-review/git-review.conf"
|
||||
USER_CONFIG = os.path.join(CONFIGDIR, "git-review.conf")
|
||||
DEFAULTS = dict(scheme='ssh', hostname=False, port=None, project=False,
|
||||
branch='master', remote="gerrit", rebase="1",
|
||||
track="0", usepushurl="0", notopic=False, branchauthor="name")
|
||||
track="0", usepushurl="0", notopic=True, branchauthor="name")
|
||||
LOCAL_GIT_VERSION = (0, 0, 0)
|
||||
COPYRIGHT = """\
|
||||
Copyright OpenStack Foundation and OpenDev Contributors
|
||||
@@ -1099,27 +1099,6 @@ def assert_one_change(remote, branch, yes, have_hook):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def get_topic(target_branch):
|
||||
branch_name = get_branch_name(target_branch)
|
||||
|
||||
branch_parts = branch_name.split("/")
|
||||
if len(branch_parts) >= 3 and branch_parts[0] == "review":
|
||||
# We don't want to set the review number as the topic
|
||||
if branch_parts[2].isdigit():
|
||||
return
|
||||
|
||||
topic = "/".join(branch_parts[2:])
|
||||
if VERBOSE:
|
||||
print("Using change number %s for the topic of the change "
|
||||
"submitted" % topic)
|
||||
return topic
|
||||
|
||||
if VERBOSE:
|
||||
print("Using local branch name %s for the topic of the change "
|
||||
"submitted" % branch_name)
|
||||
return branch_name
|
||||
|
||||
|
||||
class CannotQueryOpenChangesets(CommandFailed):
|
||||
"Cannot fetch review information from gerrit"
|
||||
EXIT_CODE = 32
|
||||
@@ -1337,23 +1316,14 @@ def fetch_review(review, masterbranch, remote, project):
|
||||
except KeyError:
|
||||
raise ReviewNotFound(review)
|
||||
|
||||
try:
|
||||
topic = review_info['topic']
|
||||
if topic == masterbranch:
|
||||
topic = review
|
||||
except KeyError:
|
||||
topic = review
|
||||
try:
|
||||
author = re.sub(r'\W+', '_',
|
||||
review_info['owner'][BRANCHAUTHOR]).lower()
|
||||
except KeyError:
|
||||
author = 'unknown'
|
||||
change_number = review_info.get('number',
|
||||
review_info.get('_number', review))
|
||||
remote_branch = review_info['branch']
|
||||
|
||||
if patchset_number is None:
|
||||
branch_name = "review/%s/%s" % (author, topic)
|
||||
branch_name = "review/%s" % (change_number,)
|
||||
else:
|
||||
branch_name = "review/%s/%s-patch%s" % (author, topic, patchset_number)
|
||||
branch_name = "review/%s-patch%s" % (change_number, patchset_number)
|
||||
|
||||
print("Downloading %s from gerrit" % refspec)
|
||||
run_command_exc(PatchSetGitFetchFailed,
|
||||
@@ -1591,7 +1561,8 @@ additional information:
|
||||
help="Topic to submit branch to")
|
||||
topic_arg_group.add_argument("-T", "--no-topic", dest="notopic",
|
||||
action="store_true",
|
||||
help="No topic except if explicitly provided")
|
||||
help="No topic except if explicitly provided"
|
||||
" (deprecated)")
|
||||
|
||||
parser.add_argument("--hashtags", nargs="+",
|
||||
help="Hashtags to submit branch to")
|
||||
@@ -1876,7 +1847,7 @@ additional information:
|
||||
if options.topic is not None:
|
||||
topic = options.topic
|
||||
else:
|
||||
topic = None if options.notopic else get_topic(branch)
|
||||
topic = None
|
||||
|
||||
if topic and topic != branch:
|
||||
push_options.append("topic=%s" % topic)
|
||||
|
||||
Reference in New Issue
Block a user