Patchwork [3,of,9,py3,v2] context: work around `long` not existing on Python 3

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 5:38 p.m.
Message ID <406938c2ae5042166b7a.1489340297@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19184/
State Superseded
Headers show

Comments

Augie Fackler - March 12, 2017, 5:38 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489283824 18000
#      Sat Mar 11 20:57:04 2017 -0500
# Node ID 406938c2ae5042166b7a22cad39210cb08c80a37
# Parent  3366d024d1d7284d49609f6ce4e3e8a329fc8808
context: work around `long` not existing on Python 3

I can't figure out what this branch is even trying to accomplish, and
it was introduced in ac89a23ca814 which doesn't really shed any
insight into why longs are treated differently from ints.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -33,6 +33,7 @@  from . import (
     obsolete as obsmod,
     patch,
     phases,
+    pycompat,
     repoview,
     revlog,
     scmutil,
@@ -419,7 +420,7 @@  class changectx(basectx):
                 self._node = repo.changelog.node(changeid)
                 self._rev = changeid
                 return
-            if isinstance(changeid, long):
+            if not pycompat.ispy3 and isinstance(changeid, long):
                 changeid = str(changeid)
             if changeid == 'null':
                 self._node = nullid