D2074: py3: use range instead of xrange

2018-02-07 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGcf887d601014: py3: use range instead of xrange (authored by 
pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2074?vs=5280=5287

REVISION DETAIL
  https://phab.mercurial-scm.org/D2074

AFFECTED FILES
  tests/test-annotate.py

CHANGE DETAILS

diff --git a/tests/test-annotate.py b/tests/test-annotate.py
--- a/tests/test-annotate.py
+++ b/tests/test-annotate.py
@@ -27,7 +27,7 @@
 
 def decorate(text, rev):
 return ([annotateline(fctx=rev, lineno=i)
- for i in xrange(1, text.count(b'\n') + 1)],
+ for i in range(1, text.count(b'\n') + 1)],
 text)
 
 # Basic usage



To: pulkit, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2072: py3: use pycompat.bytestr to convert _b85chars to bytes

2018-02-07 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG01b4d88ccb24: py3: use pycompat.bytestr to convert 
_b85chars to bytes (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2072?vs=5278=5286

REVISION DETAIL
  https://phab.mercurial-scm.org/D2072

AFFECTED FILES
  mercurial/pure/base85.py

CHANGE DETAILS

diff --git a/mercurial/pure/base85.py b/mercurial/pure/base85.py
--- a/mercurial/pure/base85.py
+++ b/mercurial/pure/base85.py
@@ -9,8 +9,10 @@
 
 import struct
 
-_b85chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
-"abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"
+from .. import pycompat
+
+_b85chars = pycompat.bytestr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+ "ghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~")
 _b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]
 _b85dec = {}
 



To: pulkit, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2075: py3: add b'' prefixes to string literals in test files

2018-02-07 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa36d3c8a0e41: py3: add b prefixes to string 
literals in test files (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2075?vs=5281=5289

REVISION DETAIL
  https://phab.mercurial-scm.org/D2075

AFFECTED FILES
  tests/test-annotate.py
  tests/test-arbitraryfilectx.t
  tests/test-check-help.t
  tests/test-conflict.t
  tests/test-diff-binary-file.t

CHANGE DETAILS

diff --git a/tests/test-diff-binary-file.t b/tests/test-diff-binary-file.t
--- a/tests/test-diff-binary-file.t
+++ b/tests/test-diff-binary-file.t
@@ -81,7 +81,7 @@
   $ cat > writebin.py < import sys
   > path = sys.argv[1]
-  > open(path, 'wb').write('\x00\x01\x02\x03')
+  > open(path, 'wb').write(b'\x00\x01\x02\x03')
   > EOF
   $ $PYTHON writebin.py binfile.bin
   $ hg add binfile.bin
diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -139,8 +139,8 @@
   $ hg up -q --clean .
   $ $PYTHON < fp = open('logfile', 'w')
-  > fp.write('12345678901234567890123456789012345678901234567890' +
-  >  '1234567890') # there are 5 more columns for 80 columns
+  > fp.write(b'12345678901234567890123456789012345678901234567890' +
+  >  b'1234567890') # there are 5 more columns for 80 columns
   > 
   > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
   > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
diff --git a/tests/test-check-help.t b/tests/test-check-help.t
--- a/tests/test-check-help.t
+++ b/tests/test-check-help.t
@@ -10,7 +10,7 @@
   > import os, msvcrt
   > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
   > topics = set()
-  > topicre = re.compile(r':hg:`help ([a-z0-9\-.]+)`')
+  > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
   > for fname in sys.argv:
   > with open(fname) as f:
   > topics.update(m.group(1) for m in topicre.finditer(f.read()))
diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t
--- a/tests/test-arbitraryfilectx.t
+++ b/tests/test-arbitraryfilectx.t
@@ -7,9 +7,9 @@
   > command = registrar.command(cmdtable)
   > @command(b'eval', [], 'hg eval CMD')
   > def eval_(ui, repo, *cmds, **opts):
-  > cmd = " ".join(cmds)
+  > cmd = b" ".join(cmds)
   > res = str(eval(cmd, globals(), locals()))
-  > ui.warn("%s" % res)
+  > ui.warn(b"%s" % res)
   > EOF
 
   $ echo "[extensions]" >> $HGRCPATH
diff --git a/tests/test-annotate.py b/tests/test-annotate.py
--- a/tests/test-annotate.py
+++ b/tests/test-annotate.py
@@ -36,67 +36,67 @@
 p1ann = decorate(p1data, p1fctx)
 p1ann = _annotatepair([oldann], p1fctx, p1ann, False, diffopts)
 self.assertEqual(p1ann[0], [
-annotateline('old', 1),
-annotateline('old', 2),
-annotateline('p1', 3),
+annotateline(b'old', 1),
+annotateline(b'old', 2),
+annotateline(b'p1', 3),
 ])
 
 p2ann = decorate(p2data, p2fctx)
 p2ann = _annotatepair([oldann], p2fctx, p2ann, False, diffopts)
 self.assertEqual(p2ann[0], [
-annotateline('old', 1),
-annotateline('p2', 2),
-annotateline('p2', 3),
+annotateline(b'old', 1),
+annotateline(b'p2', 2),
+annotateline(b'p2', 3),
 ])
 
 # Test with multiple parents (note the difference caused by ordering)
 
 childann = decorate(childdata, childfctx)
 childann = _annotatepair([p1ann, p2ann], childfctx, childann, False,
  diffopts)
 self.assertEqual(childann[0], [
-annotateline('old', 1),
-annotateline('c', 2),
-annotateline('p2', 2),
-annotateline('c', 4),
-annotateline('p2', 3),
+annotateline(b'old', 1),
+annotateline(b'c', 2),
+annotateline(b'p2', 2),
+annotateline(b'c', 4),
+annotateline(b'p2', 3),
 ])
 
 childann = decorate(childdata, childfctx)
 childann = _annotatepair([p2ann, p1ann], childfctx, childann, False,
  diffopts)
 self.assertEqual(childann[0], [
-annotateline('old', 1),
-annotateline('c', 2),
-annotateline('p1', 3),
-annotateline('c', 4),
-annotateline('p2', 3),
+annotateline(b'old', 1),
+annotateline(b'c', 2),
+annotateline(b'p1', 3),
+annotateline(b'c', 4),
+annotateline(b'p2', 3),
 ])
 
 # Test with skipchild (note the difference caused by ordering)
 
 childann = decorate(childdata, childfctx)
 childann = _annotatepair([p1ann, p2ann], childfctx, childann, True,
  diffopts)
 self.assertEqual(childann[0], [
-  

D2070: py3: use pycompat.ziplist instead of zip

2018-02-07 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf81df691efe7: py3: use pycompat.ziplist instead of zip 
(authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2070?vs=5276=5284

REVISION DETAIL
  https://phab.mercurial-scm.org/D2070

AFFECTED FILES
  mercurial/dispatch.py

CHANGE DETAILS

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -477,7 +477,8 @@
 if earlyopts:
 self.badalias = (_("error in definition for alias '%s': %s may "
"only be given on the command line")
- % (self.name, '/'.join(zip(*earlyopts)[0])))
+ % (self.name, 
'/'.join(pycompat.ziplist(*earlyopts)
+[0])))
 return
 self.cmdname = cmd = args.pop(0)
 self.givenargs = args



To: pulkit, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2077: py3: make sure we open the file in bytes mode

2018-02-07 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG80e5210df25c: py3: make sure we open the file in bytes mode 
(authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2077?vs=5283=5291

REVISION DETAIL
  https://phab.mercurial-scm.org/D2077

AFFECTED FILES
  tests/test-check-help.t
  tests/test-conflict.t

CHANGE DETAILS

diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -138,7 +138,7 @@
 
   $ hg up -q --clean .
   $ $PYTHON < fp = open('logfile', 'w')
+  > fp = open('logfile', 'wb')
   > fp.write(b'12345678901234567890123456789012345678901234567890' +
   >  b'1234567890') # there are 5 more columns for 80 columns
   > 
diff --git a/tests/test-check-help.t b/tests/test-check-help.t
--- a/tests/test-check-help.t
+++ b/tests/test-check-help.t
@@ -12,7 +12,7 @@
   > topics = set()
   > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
   > for fname in sys.argv:
-  > with open(fname) as f:
+  > with open(fname, 'rb') as f:
   > topics.update(m.group(1) for m in topicre.finditer(f.read()))
   > for s in sorted(topics):
   > print(s)



To: pulkit, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2073: py3: use open() instead of file()

2018-02-07 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1dbd8a62b581: py3: use open() instead of file() (authored 
by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2073?vs=5279=5288

REVISION DETAIL
  https://phab.mercurial-scm.org/D2073

AFFECTED FILES
  tests/test-mq-eol.t

CHANGE DETAILS

diff --git a/tests/test-mq-eol.t b/tests/test-mq-eol.t
--- a/tests/test-mq-eol.t
+++ b/tests/test-mq-eol.t
@@ -10,7 +10,7 @@
   > EOF
 
   $ cat > makepatch.py < f = file('eol.diff', 'wb')
+  > f = open('eol.diff', 'wb')
   > w = f.write
   > w('test message\n')
   > w('diff --git a/a b/a\n')
@@ -30,7 +30,7 @@
 
   $ cat > cateol.py < import sys
-  > for line in file(sys.argv[1], 'rb'):
+  > for line in open(sys.argv[1], 'rb'):
   > line = line.replace('\r', '')
   > line = line.replace('\n', '')
   > print(line)
@@ -44,7 +44,7 @@
 
 Test different --eol values
 
-  $ $PYTHON -c 'file("a", "wb").write("a\nb\nc\nd\ne")'
+  $ $PYTHON -c 'open("a", "wb").write("a\nb\nc\nd\ne")'
   $ hg ci -Am adda
   adding .hgignore
   adding a
@@ -152,15 +152,15 @@
 
   $ hg init testeol
   $ cd testeol
-  $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n3\r\n4')"
+  $ $PYTHON -c "open('a', 'wb').write('1\r\n2\r\n3\r\n4')"
   $ hg ci -Am adda
   adding a
-  $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n33\r\n4')"
+  $ $PYTHON -c "open('a', 'wb').write('1\r\n2\r\n33\r\n4')"
   $ hg qnew patch1
   $ hg qpop
   popping patch1
   patch queue now empty
-  $ $PYTHON -c "file('a', 'wb').write('1\r\n22\r\n33\r\n4')"
+  $ $PYTHON -c "open('a', 'wb').write('1\r\n22\r\n33\r\n4')"
   $ hg ci -m changea
 
   $ hg --config 'patch.eol=LF' qpush



To: pulkit, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2071: py3: use pycompat.bytechr instead of chr

2018-02-07 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbdb6ec909878: py3: use pycompat.bytechr instead of chr 
(authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2071?vs=5277=5285

REVISION DETAIL
  https://phab.mercurial-scm.org/D2071

AFFECTED FILES
  mercurial/mdiff.py

CHANGE DETAILS

diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -465,9 +465,9 @@
 def fmtline(line):
 l = len(line)
 if l <= 26:
-l = chr(ord('A') + l - 1)
+l = pycompat.bytechr(ord('A') + l - 1)
 else:
-l = chr(l - 26 + ord('a') - 1)
+l = pycompat.bytechr(l - 26 + ord('a') - 1)
 return '%c%s\n' % (l, util.b85encode(line, True))
 
 def chunk(text, csize=52):



To: pulkit, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2057: translate base85.c into rust code

2018-02-07 Thread kevincox (Kevin Cox)
kevincox added a comment.


  I agree with the splitting comments :) In fact there might already be a 
base85 crate which can be used: https://docs.rs/zero85. Either way I'll hold 
off on the review, feel free to ping me when you are ready for me to take a 
look.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2057

To: Ivzhh, #hg-reviewers
Cc: indygreg, durin42, kevincox, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2077: py3: make sure we open the file in bytes mode

2018-02-07 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  1. skip-blame because we are just adding b

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2077

AFFECTED FILES
  tests/test-check-help.t
  tests/test-conflict.t

CHANGE DETAILS

diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -138,7 +138,7 @@
 
   $ hg up -q --clean .
   $ $PYTHON < fp = open('logfile', 'w')
+  > fp = open('logfile', 'wb')
   > fp.write(b'12345678901234567890123456789012345678901234567890' +
   >  b'1234567890') # there are 5 more columns for 80 columns
   > 
diff --git a/tests/test-check-help.t b/tests/test-check-help.t
--- a/tests/test-check-help.t
+++ b/tests/test-check-help.t
@@ -12,7 +12,7 @@
   > topics = set()
   > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
   > for fname in sys.argv:
-  > with open(fname) as f:
+  > with open(fname, 'rb') as f:
   > topics.update(m.group(1) for m in topicre.finditer(f.read()))
   > for s in sorted(topics):
   > print(s)



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2076: py3: use bytes instead of str

2018-02-07 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2076

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1272,7 +1272,7 @@
 if msg == defaultmsg.strip():
 msg = ''
 ph.setmessage(msg)
-p.write(str(ph))
+p.write(bytes(ph))
 if commitfiles:
 parent = self.qparents(repo, n)
 if inclsubs:
@@ -1853,7 +1853,7 @@
 self.putsubstate2changes(substatestate, c)
 chunks = patchmod.diff(repo, patchparent,
changes=c, opts=diffopts)
-comments = str(ph)
+comments = bytes(ph)
 if comments:
 patchf.write(comments)
 for chunk in chunks:



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2075: py3: add b'' prefixes to string literals in test files

2018-02-07 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  1. skip-blame because we are just adding b''

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2075

AFFECTED FILES
  tests/test-annotate.py
  tests/test-arbitraryfilectx.t
  tests/test-check-help.t
  tests/test-conflict.t
  tests/test-diff-binary-file.t

CHANGE DETAILS

diff --git a/tests/test-diff-binary-file.t b/tests/test-diff-binary-file.t
--- a/tests/test-diff-binary-file.t
+++ b/tests/test-diff-binary-file.t
@@ -81,7 +81,7 @@
   $ cat > writebin.py < import sys
   > path = sys.argv[1]
-  > open(path, 'wb').write('\x00\x01\x02\x03')
+  > open(path, 'wb').write(b'\x00\x01\x02\x03')
   > EOF
   $ $PYTHON writebin.py binfile.bin
   $ hg add binfile.bin
diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -139,8 +139,8 @@
   $ hg up -q --clean .
   $ $PYTHON < fp = open('logfile', 'w')
-  > fp.write('12345678901234567890123456789012345678901234567890' +
-  >  '1234567890') # there are 5 more columns for 80 columns
+  > fp.write(b'12345678901234567890123456789012345678901234567890' +
+  >  b'1234567890') # there are 5 more columns for 80 columns
   > 
   > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
   > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
diff --git a/tests/test-check-help.t b/tests/test-check-help.t
--- a/tests/test-check-help.t
+++ b/tests/test-check-help.t
@@ -10,7 +10,7 @@
   > import os, msvcrt
   > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
   > topics = set()
-  > topicre = re.compile(r':hg:`help ([a-z0-9\-.]+)`')
+  > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
   > for fname in sys.argv:
   > with open(fname) as f:
   > topics.update(m.group(1) for m in topicre.finditer(f.read()))
diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t
--- a/tests/test-arbitraryfilectx.t
+++ b/tests/test-arbitraryfilectx.t
@@ -7,9 +7,9 @@
   > command = registrar.command(cmdtable)
   > @command(b'eval', [], 'hg eval CMD')
   > def eval_(ui, repo, *cmds, **opts):
-  > cmd = " ".join(cmds)
+  > cmd = b" ".join(cmds)
   > res = str(eval(cmd, globals(), locals()))
-  > ui.warn("%s" % res)
+  > ui.warn(b"%s" % res)
   > EOF
 
   $ echo "[extensions]" >> $HGRCPATH
diff --git a/tests/test-annotate.py b/tests/test-annotate.py
--- a/tests/test-annotate.py
+++ b/tests/test-annotate.py
@@ -36,67 +36,67 @@
 p1ann = decorate(p1data, p1fctx)
 p1ann = _annotatepair([oldann], p1fctx, p1ann, False, diffopts)
 self.assertEqual(p1ann[0], [
-annotateline('old', 1),
-annotateline('old', 2),
-annotateline('p1', 3),
+annotateline(b'old', 1),
+annotateline(b'old', 2),
+annotateline(b'p1', 3),
 ])
 
 p2ann = decorate(p2data, p2fctx)
 p2ann = _annotatepair([oldann], p2fctx, p2ann, False, diffopts)
 self.assertEqual(p2ann[0], [
-annotateline('old', 1),
-annotateline('p2', 2),
-annotateline('p2', 3),
+annotateline(b'old', 1),
+annotateline(b'p2', 2),
+annotateline(b'p2', 3),
 ])
 
 # Test with multiple parents (note the difference caused by ordering)
 
 childann = decorate(childdata, childfctx)
 childann = _annotatepair([p1ann, p2ann], childfctx, childann, False,
  diffopts)
 self.assertEqual(childann[0], [
-annotateline('old', 1),
-annotateline('c', 2),
-annotateline('p2', 2),
-annotateline('c', 4),
-annotateline('p2', 3),
+annotateline(b'old', 1),
+annotateline(b'c', 2),
+annotateline(b'p2', 2),
+annotateline(b'c', 4),
+annotateline(b'p2', 3),
 ])
 
 childann = decorate(childdata, childfctx)
 childann = _annotatepair([p2ann, p1ann], childfctx, childann, False,
  diffopts)
 self.assertEqual(childann[0], [
-annotateline('old', 1),
-annotateline('c', 2),
-annotateline('p1', 3),
-annotateline('c', 4),
-annotateline('p2', 3),
+annotateline(b'old', 1),
+annotateline(b'c', 2),
+annotateline(b'p1', 3),
+annotateline(b'c', 4),
+annotateline(b'p2', 3),
 ])
 
 # Test with skipchild (note the difference caused by ordering)
 
 childann = decorate(childdata, childfctx)
 childann = _annotatepair([p1ann, p2ann], childfctx, childann, True,
  diffopts)
 self.assertEqual(childann[0], [
-annotateline('old', 1),
-annotateline('old', 2, True),
+

D2074: py3: use range instead of xrange

2018-02-07 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  xrange is not available on Python 3.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2074

AFFECTED FILES
  tests/test-annotate.py

CHANGE DETAILS

diff --git a/tests/test-annotate.py b/tests/test-annotate.py
--- a/tests/test-annotate.py
+++ b/tests/test-annotate.py
@@ -27,7 +27,7 @@
 
 def decorate(text, rev):
 return ([annotateline(fctx=rev, lineno=i)
- for i in xrange(1, text.count(b'\n') + 1)],
+ for i in range(1, text.count(b'\n') + 1)],
 text)
 
 # Basic usage



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2071: py3: use pycompat.bytechr instead of chr

2018-02-07 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2071

AFFECTED FILES
  mercurial/mdiff.py

CHANGE DETAILS

diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -465,9 +465,9 @@
 def fmtline(line):
 l = len(line)
 if l <= 26:
-l = chr(ord('A') + l - 1)
+l = pycompat.bytechr(ord('A') + l - 1)
 else:
-l = chr(l - 26 + ord('a') - 1)
+l = pycompat.bytechr(l - 26 + ord('a') - 1)
 return '%c%s\n' % (l, util.b85encode(line, True))
 
 def chunk(text, csize=52):



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2073: py3: use open() instead of file()

2018-02-07 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  file() is not present in Python 3.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2073

AFFECTED FILES
  tests/test-mq-eol.t

CHANGE DETAILS

diff --git a/tests/test-mq-eol.t b/tests/test-mq-eol.t
--- a/tests/test-mq-eol.t
+++ b/tests/test-mq-eol.t
@@ -10,7 +10,7 @@
   > EOF
 
   $ cat > makepatch.py < f = file('eol.diff', 'wb')
+  > f = open('eol.diff', 'wb')
   > w = f.write
   > w('test message\n')
   > w('diff --git a/a b/a\n')
@@ -30,7 +30,7 @@
 
   $ cat > cateol.py < import sys
-  > for line in file(sys.argv[1], 'rb'):
+  > for line in open(sys.argv[1], 'rb'):
   > line = line.replace('\r', '')
   > line = line.replace('\n', '')
   > print(line)
@@ -44,7 +44,7 @@
 
 Test different --eol values
 
-  $ $PYTHON -c 'file("a", "wb").write("a\nb\nc\nd\ne")'
+  $ $PYTHON -c 'open("a", "wb").write("a\nb\nc\nd\ne")'
   $ hg ci -Am adda
   adding .hgignore
   adding a
@@ -152,15 +152,15 @@
 
   $ hg init testeol
   $ cd testeol
-  $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n3\r\n4')"
+  $ $PYTHON -c "open('a', 'wb').write('1\r\n2\r\n3\r\n4')"
   $ hg ci -Am adda
   adding a
-  $ $PYTHON -c "file('a', 'wb').write('1\r\n2\r\n33\r\n4')"
+  $ $PYTHON -c "open('a', 'wb').write('1\r\n2\r\n33\r\n4')"
   $ hg qnew patch1
   $ hg qpop
   popping patch1
   patch queue now empty
-  $ $PYTHON -c "file('a', 'wb').write('1\r\n22\r\n33\r\n4')"
+  $ $PYTHON -c "open('a', 'wb').write('1\r\n22\r\n33\r\n4')"
   $ hg ci -m changea
 
   $ hg --config 'patch.eol=LF' qpush



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2070: py3: use pycompat.ziplist instead of zip

2018-02-07 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  zip returns a zip object instead of a list on Python 3.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2070

AFFECTED FILES
  mercurial/dispatch.py

CHANGE DETAILS

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -477,7 +477,8 @@
 if earlyopts:
 self.badalias = (_("error in definition for alias '%s': %s may "
"only be given on the command line")
- % (self.name, '/'.join(zip(*earlyopts)[0])))
+ % (self.name, 
'/'.join(pycompat.ziplist(*earlyopts)
+[0])))
 return
 self.cmdname = cmd = args.pop(0)
 self.givenargs = args



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2072: py3: use pycompat.bytestr to convert _b85chars to bytes

2018-02-07 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The tranformer does append b'' to the value and make that a bytes but bytes in
  Python 3 returns the ascii value on getting characters using indexing.
  Characters of this string are queried using indexing multiple times in the 
file
  and to support that we use pycompat.bytestr which returns the bytechrs using
  indexing.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2072

AFFECTED FILES
  mercurial/pure/base85.py

CHANGE DETAILS

diff --git a/mercurial/pure/base85.py b/mercurial/pure/base85.py
--- a/mercurial/pure/base85.py
+++ b/mercurial/pure/base85.py
@@ -9,8 +9,10 @@
 
 import struct
 
-_b85chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
-"abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"
+from .. import pycompat
+
+_b85chars = pycompat.bytestr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"
+ "ghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~")
 _b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]
 _b85dec = {}
 



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


<    1   2