Merge "Stop setting a default topic on new changes"
This commit is contained in:
commit
2819a5af41
@ -16,16 +16,12 @@ If you want to submit to a different remote::
|
||||
|
||||
If you want to supply a review topic::
|
||||
|
||||
git review -t topic/awesome-feature
|
||||
git review -t awesome-feature
|
||||
|
||||
If you want to subscribe some reviewers::
|
||||
|
||||
git review --reviewers a@example.com b@example.com
|
||||
|
||||
If you want to disable autogenerated topic::
|
||||
|
||||
git review -T
|
||||
|
||||
If you want to submit a branch for review and then remove the local branch::
|
||||
|
||||
git review -f
|
||||
|
29
git-review.1
29
git-review.1
@ -72,7 +72,7 @@ The following options are available:
|
||||
Download
|
||||
.Ar change
|
||||
from Gerrit
|
||||
into a local branch. The branch will be named after the patch author and the name of a topic.
|
||||
into a local branch. The branch will be named after the change number.
|
||||
If the local branch already exists, it will attempt to update with the latest patchset for this change.
|
||||
.It Fl x Ar change , Fl \-cherrypick= Ns Ar change
|
||||
Apply
|
||||
@ -156,9 +156,8 @@ the built-in version.
|
||||
Just run the repo setup commands but don\(aqt submit anything.
|
||||
.It Fl t Ar topic , Fl \-topic= Ns Ar topic
|
||||
Sets the target topic for this change on the Gerrit server.
|
||||
If not specified, a bug number from the commit summary will be used. Alternatively, the local branch name will be used if different from remote branch.
|
||||
.It Fl T , Fl \-no\-topic
|
||||
Submit review without topic.
|
||||
Submit review without topic (the default).
|
||||
.It Fl \-hashtags= Ns Ar taglist
|
||||
Comma-separated list of hashtag strings for this change, no spaces allowed.
|
||||
.It Fl \-message= Ns Ar message
|
||||
@ -264,7 +263,10 @@ This setting determines the default name to use for gerrit remote
|
||||
.It gitreview.branch
|
||||
This setting determines the default branch
|
||||
.It gitreview.notopic
|
||||
Set to true to never submit with a default topic
|
||||
Set to true to never submit with a default topic (deprecated).
|
||||
This is the default behavior and this option has no effect. It is
|
||||
kept for backwards compatability and may be removed in a future
|
||||
version of git-review.
|
||||
.It gitreview.track
|
||||
Determines whether to prefer the currently-tracked branch (if any)
|
||||
and the branch against which the changeset was submitted to Gerrit
|
||||
@ -466,26 +468,23 @@ To fetch a remote change number 3004:
|
||||
.Bd -literal -offset indent
|
||||
$ git\-review \-d 3004
|
||||
Downloading refs/changes/04/3004/1 from gerrit into
|
||||
review/someone/topic_name
|
||||
Switched to branch 'review/someone/topic_name
|
||||
review/3004
|
||||
Switched to branch 'review/3004
|
||||
$ git branch
|
||||
master
|
||||
* review/author/topic_name
|
||||
* review/3004
|
||||
.Ed
|
||||
.Pp
|
||||
Gerrit looks up both name of the author and the topic name from Gerrit
|
||||
to name a local branch. This facilitates easier identification of changes.
|
||||
.Pp
|
||||
To fetch a remote patchset number 5 from change number 3004:
|
||||
.Pp
|
||||
.Bd -literal -offset indent
|
||||
$ git\-review \-d 3004,5
|
||||
Downloading refs/changes/04/3004/5 from gerrit into
|
||||
review/someone/topic_name\-patch5
|
||||
Switched to branch 'review/someone/topic_name\-patch5
|
||||
review/3004\-patch5
|
||||
Switched to branch 'review/3004\-patch5
|
||||
$ git branch
|
||||
master
|
||||
* review/author/topic_name\-patch5
|
||||
* review/3004\-patch5
|
||||
.Ed
|
||||
.Pp
|
||||
To send a change for review and delete local branch afterwards:
|
||||
@ -493,9 +492,9 @@ To send a change for review and delete local branch afterwards:
|
||||
$ git\-review \-f
|
||||
remote: Resolving deltas: 0% (0/8)
|
||||
To ssh://username@review.example.com/department/project.git
|
||||
* [new branch] HEAD \-> refs/for/master/topic_name
|
||||
* [new branch] HEAD \-> refs/for/master
|
||||
Switched to branch 'master'
|
||||
Deleted branch 'review/someone/topic_name'
|
||||
Deleted branch 'review/somenumber'
|
||||
$ git branch
|
||||
* master
|
||||
.Ed
|
||||
|
@ -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)
|
||||
|
@ -554,18 +554,19 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase):
|
||||
extra_args=['-t', 'zat'])
|
||||
|
||||
def test_git_review_T(self):
|
||||
# This option is deprecated and kept for compatibility; the
|
||||
# only behavior now is "notopic".
|
||||
self._run_git_review('-s')
|
||||
self._run_git('checkout', '-b', 'bug/456')
|
||||
self._simple_change('test file modified', 'commit message for bug 456')
|
||||
self._assert_branch_would_be('master%topic=bug/456')
|
||||
self._assert_branch_would_be('master')
|
||||
self._assert_branch_would_be('master', extra_args=['-T'])
|
||||
|
||||
self._run_git('config', 'gitreview.notopic', 'true')
|
||||
self._assert_branch_would_be('master')
|
||||
self._run_git('config', 'gitreview.notopic', 'false')
|
||||
self._assert_branch_would_be('master%topic=bug/456')
|
||||
self._assert_branch_would_be('master')
|
||||
|
||||
# -T takes precedence over notopic=false
|
||||
self._assert_branch_would_be('master', extra_args=['-T'])
|
||||
|
||||
def test_git_review_T_t(self):
|
||||
|
15
releasenotes/notes/deprecate-notopic-b198a4b51e8624b2.yaml
Normal file
15
releasenotes/notes/deprecate-notopic-b198a4b51e8624b2.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Git-review no longer supplies a default topic when uploading a new
|
||||
change. The only way to set a topic on a newly uploaded change is
|
||||
to use the ``-t <topic>`` option.
|
||||
- |
|
||||
When downloading changes using ``git-review -d``, the local branch
|
||||
name is now based on the change number rather than the author and
|
||||
topic.
|
||||
deprecations:
|
||||
- |
|
||||
The ``gitreview.notopic`` configuration setting and ``-T`` command line
|
||||
option are deprecated and no longer have any effect. The default behavior
|
||||
is now as if ``notopic`` is set.
|
Loading…
x
Reference in New Issue
Block a user