[PATCH 1 of 8] py3: fix type of regex literals in patch.py
Augie Fackler
raf at durin42.com
Tue Sep 12 23:00:03 EDT 2017
On Sun, Sep 03, 2017 at 11:36:19PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1504422735 -32400
> # Sun Sep 03 16:12:15 2017 +0900
> # Node ID 313ecdde1470bb3a0e1f9beced7e596b8004e456
> # Parent 68afb88b51bb626cd25440e2df812f2306463b55
> py3: fix type of regex literals in patch.py
Series LGTM, but I can't get them to apply despite my best efforts. Resend?
Or just push them yourself, and I'll look at them when they land. Either way.
>
> diff --git a/mercurial/patch.py b/mercurial/patch.py
> --- a/mercurial/patch.py
> +++ b/mercurial/patch.py
> @@ -205,10 +205,11 @@ def extract(ui, fileobj):
>
> # attempt to detect the start of a patch
> # (this heuristic is borrowed from quilt)
> - diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
> - r'retrieving revision [0-9]+(\.[0-9]+)*$|'
> - r'---[ \t].*?^\+\+\+[ \t]|'
> - r'\*\*\*[ \t].*?^---[ \t])', re.MULTILINE|re.DOTALL)
> + diffre = re.compile(br'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
> + br'retrieving revision [0-9]+(\.[0-9]+)*$|'
> + br'---[ \t].*?^\+\+\+[ \t]|'
> + br'\*\*\*[ \t].*?^---[ \t])',
> + re.MULTILINE | re.DOTALL)
>
> data = {}
> fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
> @@ -230,7 +231,7 @@ def extract(ui, fileobj):
> pend = subject.find(']')
> if pend >= 0:
> subject = subject[pend + 1:].lstrip()
> - subject = re.sub(r'\n[ \t]+', ' ', subject)
> + subject = re.sub(br'\n[ \t]+', ' ', subject)
> ui.debug('Subject: %s\n' % subject)
> if data['user']:
> ui.debug('From: %s\n' % data['user'])
> @@ -1760,7 +1761,7 @@ def scanpatch(fp):
> - ('hunk', [hunk_lines])
> - ('range', (-start,len, +start,len, proc))
> """
> - lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
> + lines_re = re.compile(br'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
> lr = linereader(fp)
>
> def scanwhile(first, p):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list