Mercurial > hg
comparison mercurial/archival.py @ 43506:9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
This is the promised second step on single-quoted strings. These had
existed because our source transformer didn't turn r'' into b'', so we
had tagged some strings as r-strings to get "native" strings on both
Pythons. Now that the transformer is gone, we can dispense with this
nonsense.
Methodology:
I ran
hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$' | xargs egrep --color=never -n -- \[\^b\]\[\^a-z\]r\'\[\^\'\\\\\]\*\'\[\^\'\
in an emacs grep-mode buffer, and then used a keyboard macro to
iterate over the results and remove the r prefix as needed.
# skip-blame removing unneeded r prefixes left over from Python 3 migration.
Differential Revision: https://phab.mercurial-scm.org/D7306
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 08 Nov 2019 11:19:20 -0800 |
parents | d5bef33ab83c |
children | e786d69c665d 6c36a521572e |
comparison
equal
deleted
inserted
replaced
43505:47fac1692ede | 43506:9f70512ae2cf |
---|---|
136 or compress with gzip or bzip2.''' | 136 or compress with gzip or bzip2.''' |
137 | 137 |
138 class GzipFileWithTime(gzip.GzipFile): | 138 class GzipFileWithTime(gzip.GzipFile): |
139 def __init__(self, *args, **kw): | 139 def __init__(self, *args, **kw): |
140 timestamp = None | 140 timestamp = None |
141 if r'timestamp' in kw: | 141 if 'timestamp' in kw: |
142 timestamp = kw.pop(r'timestamp') | 142 timestamp = kw.pop('timestamp') |
143 if timestamp is None: | 143 if timestamp is None: |
144 self.timestamp = time.time() | 144 self.timestamp = time.time() |
145 else: | 145 else: |
146 self.timestamp = timestamp | 146 self.timestamp = timestamp |
147 gzip.GzipFile.__init__(self, *args, **kw) | 147 gzip.GzipFile.__init__(self, *args, **kw) |
220 | 220 |
221 def __init__(self, dest, mtime, compress=True): | 221 def __init__(self, dest, mtime, compress=True): |
222 if isinstance(dest, bytes): | 222 if isinstance(dest, bytes): |
223 dest = pycompat.fsdecode(dest) | 223 dest = pycompat.fsdecode(dest) |
224 self.z = zipfile.ZipFile( | 224 self.z = zipfile.ZipFile( |
225 dest, r'w', compress and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED | 225 dest, 'w', compress and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED |
226 ) | 226 ) |
227 | 227 |
228 # Python's zipfile module emits deprecation warnings if we try | 228 # Python's zipfile module emits deprecation warnings if we try |
229 # to store files with a date before 1980. | 229 # to store files with a date before 1980. |
230 epoch = 315532800 # calendar.timegm((1980, 1, 1, 0, 0, 0, 1, 1, 0)) | 230 epoch = 315532800 # calendar.timegm((1980, 1, 1, 0, 0, 0, 1, 1, 0)) |