hgext3rd/topic/revset.py
changeset 4814 48b30ff742cb
parent 4717 7b36f9728351
child 5193 a4d081923c81
child 5223 cc9b6e64027c
child 5298 a828c7a7ace1
--- a/hgext3rd/topic/revset.py	Tue Aug 06 15:06:27 2019 +0200
+++ b/hgext3rd/topic/revset.py	Tue Aug 06 15:06:38 2019 +0200
@@ -24,7 +24,7 @@
 revsetpredicate = registrar.revsetpredicate()
 
 def getstringstrict(x, err):
-    if x and x[0] == 'string':
+    if x and x[0] == b'string':
         return x[1]
     raise error.ParseError(err)
 
@@ -36,7 +36,7 @@
     If `string` starts with `re:` the remainder of the name is treated
     as a regular expression.
     """
-    args = revset.getargs(x, 0, 1, 'topic takes one or no arguments')
+    args = revset.getargs(x, 0, 1, b'topic takes one or no arguments')
 
     mutable = revset._notpublic(repo, revset.fullreposet(repo), ())
 
@@ -44,15 +44,15 @@
         return (subset & mutable).filter(lambda r: bool(repo[r].topic()))
 
     try:
-        topic = getstringstrict(args[0], '')
+        topic = getstringstrict(args[0], b'')
     except error.ParseError:
         # not a string, but another revset
         pass
     else:
         kind, pattern, matcher = mkmatcher(topic)
 
-        if topic.startswith('literal:') and pattern not in repo.topics:
-            raise error.RepoLookupError("topic '%s' does not exist" % pattern)
+        if topic.startswith(b'literal:') and pattern not in repo.topics:
+            raise error.RepoLookupError(b"topic '%s' does not exist" % pattern)
 
         def matches(r):
             topic = repo[r].topic()
@@ -64,7 +64,7 @@
 
     s = revset.getset(repo, revset.fullreposet(repo), x)
     topics = {repo[r].topic() for r in s}
-    topics.discard('')
+    topics.discard(b'')
 
     def matches(r):
         if r in s:
@@ -82,11 +82,11 @@
 
     Name is horrible so that people change it.
     """
-    args = revset.getargs(x, 1, 1, 'ngtip takes one argument')
+    args = revset.getargs(x, 1, 1, b'ngtip takes one argument')
     # match a specific topic
-    branch = revset.getstring(args[0], 'ngtip requires a string')
-    if branch == '.':
-        branch = repo['.'].branch()
+    branch = revset.getstring(args[0], b'ngtip requires a string')
+    if branch == b'.':
+        branch = repo[b'.'].branch()
     return subset & revset.baseset(destination.ngtip(repo, branch))
 
 @revsetpredicate(b'stack()')
@@ -97,7 +97,7 @@
     unstable changeset after there future parent (as if evolve where already
     run).
     """
-    err = 'stack takes no arguments, it works on current topic'
+    err = b'stack takes no arguments, it works on current topic'
     revset.getargs(x, 0, 0, err)
     topic = None
     branch = None
@@ -120,8 +120,8 @@
         if isinstance(z, tuple):
             a, b = revset.getintrange(
                 z,
-                'relation subscript must be an integer or a range',
-                'relation subscript bounds must be integers',
+                b'relation subscript must be an integer or a range',
+                b'relation subscript bounds must be integers',
                 None, None)
         else:
             a = b = z
@@ -159,12 +159,12 @@
 
         return subset & revset.baseset(revs)
 
-    revset.subscriptrelations['stack'] = stackrel
-    revset.subscriptrelations['s'] = stackrel
+    revset.subscriptrelations[b'stack'] = stackrel
+    revset.subscriptrelations[b's'] = stackrel
 
     def topicrel(repo, subset, x, *args):
         subset &= topicset(repo, subset, x)
         return revset.generationsrel(repo, subset, x, *args)
 
-    revset.subscriptrelations['topic'] = topicrel
-    revset.subscriptrelations['t'] = topicrel
+    revset.subscriptrelations[b'topic'] = topicrel
+    revset.subscriptrelations[b't'] = topicrel