reviewboard: report whether obsolescence is enabled (
bug 1242246); r?dminor
When Mercurial's obsolescence feature is enabled, the algorithm mapping
commits to review requests can make stronger assertions about how
commits changed over time.
Currently, clients with obsolescence enabled may report precursor nodes
for changesets submitted for review. However, there is no way to
distinguish a submission with obsolescence disabled from one where
obsolescence is enabled but there are no precursor nodes.
This commit adds a parameter to the review request submission requests
to inform the batch review request API whether the client has
obsolescence enabled. This will be used in a subsequent commit to change
commit mapping behavior.
MozReview-Commit-ID: J2jsV1XFbpL
--- a/hgext/reviewboard/client.py
+++ b/hgext/reviewboard/client.py
@@ -538,16 +538,17 @@ def doreview(repo, ui, remote, nodes):
'code review experience, use bookmark-based development '
'with changeset evolution. Read more at '
'http://mozilla-version-control-tools.readthedocs.org/en/latest/mozreview-user.html)\n'))
break
req = commonrequestdict(ui, bzauth)
req['identifier'] = identifier.full
req['changesets'] = []
+ req['obsolescence'] = obsolete.isenabled(repo, obsolete.createmarkersopt)
reviews = repo.reviews
oldparentid = reviews.findparentreview(identifier=identifier.full)
# Include obsolescence data so server can make intelligent decisions.
obsstore = repo.obsstore
for node in nodes:
precursors = [hex(n) for n in obsolete.allprecursors(obsstore, [node])]
--- a/hgext/reviewboard/hgrb/proto.py
+++ b/hgext/reviewboard/hgrb/proto.py
@@ -211,17 +211,18 @@ def _processpushreview(repo, req, ldap_u
nodes.append(node)
if 'precursors' in cset:
precursors[node] = cset['precursors']
diffopts = mdiff.diffopts(context=8, showfunc=True, git=True)
commits = {
'individual': [],
- 'squashed': {}
+ 'squashed': {},
+ 'obsolescence': req.get('obsolescence', False),
}
# We do multiple passes over the changesets requested for review because
# some operations could be slow or may involve queries to external
# resources. We want to run the fast checks first so we don't waste
# resources before finding the error. The drawback here is the client
# will not see the full set of errors. We may revisit this decision
# later.
--- a/hgext/reviewboard/server.py
+++ b/hgext/reviewboard/server.py
@@ -311,16 +311,18 @@ def submitserieswebcommand(web, req, tmp
bzapikey
The Bugzilla API key to use for authentication
identifier
The review identifier creating/updating. This is effectively the series
ID.
changesets
An array of objects describing the changesets being submitted for
review. See the section below on the format of each object.
+ obsolescence (optional)
+ Bool indicating whether the client supports obsolescence.
Each changeset object has the following keys:
node
40 character hex SHA-1 of changeset being reviewed
precursors
Array of 40 character hex SHA-1 strings corresponding to precursors
of this node.