reviewboard: use parse_commit_id (
bug 1245589); r?dminor
We have a dedicated function for this now. Use it.
Also convert the description to a str so we are passing around the raw
bytes as opposed to whatever Mercurial has munged it to for local
representation.
MozReview-Commit-ID: 3fXxsiMak9Q
--- a/hgext/reviewboard/client.py
+++ b/hgext/reviewboard/client.py
@@ -18,17 +18,16 @@ This extension adds new options to the `
* --reviewid The review identifier to use. Pushes using the same
review ID will overwrite existing reviews for that ID.
* -c Single changeset to review.
"""
import errno
import json
import os
-import re
import sys
import urllib
import urllib2
from mercurial import (
cmdutil,
commands,
context,
@@ -63,17 +62,20 @@ except ImportError:
import hgrb.proto
demandimport.enable()
from hgrb.util import (
addcommitid,
ReviewID,
)
-from mozautomation.commitparser import parse_bugs
+from mozautomation.commitparser import (
+ parse_bugs,
+ parse_commit_id,
+)
from mozhg.auth import (
getbugzillaauth,
configureautobmoapikeyauth,
)
from mozhg.rewrite import (
newparents,
replacechangesets,
)
@@ -394,17 +396,17 @@ def wrappedpushdiscovery(orig, pushop):
raise util.Abort(
_('cannot review empty changeset %s') % ctx.hex()[:12],
hint=_('add files to or remove changeset'))
# Ensure all reviewed changesets have commit IDs.
replacenodes = []
for node in nodes:
ctx = repo[node]
- if not re.search('^MozReview-Commit-ID: ', ctx.description(), re.MULTILINE):
+ if not parse_commit_id(encoding.fromlocal(ctx.description())):
replacenodes.append(node)
def makememctx(repo, ctx, revmap, copyfilectxfn):
parents = newparents(repo, ctx, revmap)
# Need to make a copy otherwise modification is made on original,
# which is just plain wrong.
msg = encoding.fromlocal(ctx.description())
new_msg, changed = addcommitid(msg, repo=repo)