changeset 42567:4eaf7197a740

cleanup: use named constants for second arg to .seek() Differential Revision: https://phab.mercurial-scm.org/D6556
author Augie Fackler <augie@google.com>
date Thu, 20 Jun 2019 14:33:42 -0400
parents f802a75da585
children f9da9d5f3f5a
files hgext/fastannotate/revmap.py mercurial/revlog.py mercurial/tags.py
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fastannotate/revmap.py	Thu Jun 20 14:45:52 2019 -0700
+++ b/hgext/fastannotate/revmap.py	Thu Jun 20 14:33:42 2019 -0400
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 import bisect
+import io
 import os
 import struct
 
@@ -246,7 +247,7 @@
     hsh = None
     try:
         with open(path, 'rb') as f:
-            f.seek(-_hshlen, 2)
+            f.seek(-_hshlen, io.SEEK_END)
             if f.tell() > len(revmap.HEADER):
                 hsh = f.read(_hshlen)
     except IOError:
--- a/mercurial/revlog.py	Thu Jun 20 14:45:52 2019 -0700
+++ b/mercurial/revlog.py	Thu Jun 20 14:33:42 2019 -0400
@@ -16,6 +16,7 @@
 import collections
 import contextlib
 import errno
+import io
 import os
 import struct
 import zlib
@@ -2306,7 +2307,7 @@
 
         try:
             with self._datafp() as f:
-                f.seek(0, 2)
+                f.seek(0, io.SEEK_END)
                 actual = f.tell()
             dd = actual - expected
         except IOError as inst:
@@ -2316,7 +2317,7 @@
 
         try:
             f = self.opener(self.indexfile)
-            f.seek(0, 2)
+            f.seek(0, io.SEEK_END)
             actual = f.tell()
             f.close()
             s = self._io.size
--- a/mercurial/tags.py	Thu Jun 20 14:45:52 2019 -0700
+++ b/mercurial/tags.py	Thu Jun 20 14:33:42 2019 -0400
@@ -13,6 +13,7 @@
 from __future__ import absolute_import
 
 import errno
+import io
 
 from .node import (
     bin,
@@ -562,7 +563,7 @@
             " branch name\n") % name)
 
     def writetags(fp, names, munge, prevtags):
-        fp.seek(0, 2)
+        fp.seek(0, io.SEEK_END)
         if prevtags and not prevtags.endswith('\n'):
             fp.write('\n')
         for name in names: