Python 3.8 emits a SyntaxWarning when a str/bytes contains invalid
\ escapes. Various docstrings in our code base contain invalid
\ escapes.
This commit turns those docstrings into raw strings.
martinvonz |
hg-reviewers |
Python 3.8 emits a SyntaxWarning when a str/bytes contains invalid
\ escapes. Various docstrings in our code base contain invalid
\ escapes.
This commit turns those docstrings into raw strings.
Lint Skipped |
Unit Tests Skipped |
Should we add # skip-blame to this and rest of the series as they are just adding of r'' prefixes?
In D5816#85618, @pulkit wrote:Should we add # skip-blame to this and rest of the series as they are just adding of r'' prefixes?
I'm not sure. If there are \ in the string, adding the r'' can change the value of the string. If we introduce a bug through these changes, using skip-blame will make it harder to find that change. It's probably safe to do though, as we should be able to count on review to find any meaningful value changes.
Path | Packages | |||
---|---|---|---|---|
M | hgext/rebase.py (2 lines) | |||
M | mercurial/bookmarks.py (2 lines) | |||
M | mercurial/dagop.py (2 lines) | |||
M | setup.py (2 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Gregory Szorc | Feb 4 2019, 12:07 PM |
# rebasing and its first parent, but *not* | # rebasing and its first parent, but *not* | ||||
# duplicate any copies that have already been | # duplicate any copies that have already been | ||||
# performed in the destination. | # performed in the destination. | ||||
p1rev = repo[rev].p1().rev() | p1rev = repo[rev].p1().rev() | ||||
copies.duplicatecopies(repo, wctx, rev, p1rev, skiprev=dest) | copies.duplicatecopies(repo, wctx, rev, p1rev, skiprev=dest) | ||||
return stats | return stats | ||||
def adjustdest(repo, rev, destmap, state, skipped): | def adjustdest(repo, rev, destmap, state, skipped): | ||||
"""adjust rebase destination given the current rebase state | r"""adjust rebase destination given the current rebase state | ||||
rev is what is being rebased. Return a list of two revs, which are the | rev is what is being rebased. Return a list of two revs, which are the | ||||
adjusted destinations for rev's p1 and p2, respectively. If a parent is | adjusted destinations for rev's p1 and p2, respectively. If a parent is | ||||
nullrev, return dest without adjustment for it. | nullrev, return dest without adjustment for it. | ||||
For example, when doing rebasing B+E to F, C to G, rebase will first move B | For example, when doing rebasing B+E to F, C to G, rebase will first move B | ||||
to B1, and E's destination will be adjusted from F to B1. | to B1, and E's destination will be adjusted from F to B1. | ||||
For core, this just handles wether we should see pending | For core, this just handles wether we should see pending | ||||
bookmarks or the committed ones. Other extensions (like share) | bookmarks or the committed ones. Other extensions (like share) | ||||
may need to tweak this behavior further. | may need to tweak this behavior further. | ||||
""" | """ | ||||
fp, pending = txnutil.trypending(repo.root, repo.vfs, 'bookmarks') | fp, pending = txnutil.trypending(repo.root, repo.vfs, 'bookmarks') | ||||
return fp | return fp | ||||
class bmstore(object): | class bmstore(object): | ||||
"""Storage for bookmarks. | r"""Storage for bookmarks. | ||||
This object should do all bookmark-related reads and writes, so | This object should do all bookmark-related reads and writes, so | ||||
that it's fairly simple to replace the storage underlying | that it's fairly simple to replace the storage underlying | ||||
bookmarks without having to clone the logic surrounding | bookmarks without having to clone the logic surrounding | ||||
bookmarks. This type also should manage the active bookmark, if | bookmarks. This type also should manage the active bookmark, if | ||||
any. | any. | ||||
This particular bmstore implementation stores bookmarks as | This particular bmstore implementation stores bookmarks as |
pfunc = plainpfunc | pfunc = plainpfunc | ||||
else: | else: | ||||
pfunc = lambda rev: [r for r in plainpfunc(rev) if not cutfunc(r)] | pfunc = lambda rev: [r for r in plainpfunc(rev) if not cutfunc(r)] | ||||
revs = revs.filter(lambda rev: not cutfunc(rev)) | revs = revs.filter(lambda rev: not cutfunc(rev)) | ||||
return _walkrevtree(pfunc, revs, startdepth, stopdepth, reverse=True) | return _walkrevtree(pfunc, revs, startdepth, stopdepth, reverse=True) | ||||
def revancestors(repo, revs, followfirst=False, startdepth=None, | def revancestors(repo, revs, followfirst=False, startdepth=None, | ||||
stopdepth=None, cutfunc=None): | stopdepth=None, cutfunc=None): | ||||
"""Like revlog.ancestors(), but supports additional options, includes | r"""Like revlog.ancestors(), but supports additional options, includes | ||||
the given revs themselves, and returns a smartset | the given revs themselves, and returns a smartset | ||||
Scan ends at the stopdepth (exlusive) if specified. Revisions found | Scan ends at the stopdepth (exlusive) if specified. Revisions found | ||||
earlier than the startdepth are omitted. | earlier than the startdepth are omitted. | ||||
If cutfunc is provided, it will be used to cut the traversal of the DAG. | If cutfunc is provided, it will be used to cut the traversal of the DAG. | ||||
When cutfunc(X) returns True, the DAG traversal stops - revision X and | When cutfunc(X) returns True, the DAG traversal stops - revision X and | ||||
X's ancestors in the traversal path will be skipped. This could be an | X's ancestors in the traversal path will be skipped. This could be an |
self.hgtarget = os.path.join(dir, 'hg') | self.hgtarget = os.path.join(dir, 'hg') | ||||
self.compiler.link_executable(objects, self.hgtarget, | self.compiler.link_executable(objects, self.hgtarget, | ||||
libraries=[], | libraries=[], | ||||
output_dir=self.build_temp) | output_dir=self.build_temp) | ||||
if self.long_paths_support: | if self.long_paths_support: | ||||
self.addlongpathsmanifest() | self.addlongpathsmanifest() | ||||
def addlongpathsmanifest(self): | def addlongpathsmanifest(self): | ||||
"""Add manifest pieces so that hg.exe understands long paths | r"""Add manifest pieces so that hg.exe understands long paths | ||||
This is an EXPERIMENTAL feature, use with care. | This is an EXPERIMENTAL feature, use with care. | ||||
To enable long paths support, one needs to do two things: | To enable long paths support, one needs to do two things: | ||||
- build Mercurial with --long-paths-support option | - build Mercurial with --long-paths-support option | ||||
- change HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\ | - change HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\ | ||||
LongPathsEnabled to have value 1. | LongPathsEnabled to have value 1. | ||||
Please ignore 'warning 81010002: Unrecognized Element "longPathAware"'; | Please ignore 'warning 81010002: Unrecognized Element "longPathAware"'; |