Patchwork D1791: tests: make autodiff.py work on Python 3

login
register
mail settings
Submitter phabricator
Date Jan. 10, 2018, 11:03 p.m.
Message ID <d205dd4d2fe83981ab434eab0de98755@localhost.localdomain>
Download mbox | patch
Permalink /patch/26657/
State Not Applicable
Headers show

Comments

phabricator - Jan. 10, 2018, 11:03 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG154754d1f137: tests: make autodiff.py work on Python 3 (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1791?vs=4668&id=4774

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

AFFECTED FILES
  tests/autodiff.py

CHANGE DETAILS




To: pulkit, #hg-reviewers, durin42
Cc: durin42, mercurial-devel

Patch

diff --git a/tests/autodiff.py b/tests/autodiff.py
--- a/tests/autodiff.py
+++ b/tests/autodiff.py
@@ -12,39 +12,39 @@ 
 cmdtable = {}
 command = registrar.command(cmdtable)
 
-@command('autodiff',
-    [('', 'git', '', 'git upgrade mode (yes/no/auto/warn/abort)')],
-    '[OPTION]... [FILE]...')
+@command(b'autodiff',
+    [(b'', b'git', b'', b'git upgrade mode (yes/no/auto/warn/abort)')],
+    b'[OPTION]... [FILE]...')
 def autodiff(ui, repo, *pats, **opts):
     diffopts = patch.difffeatureopts(ui, opts)
-    git = opts.get('git', 'no')
+    git = opts.get(b'git', b'no')
     brokenfiles = set()
     losedatafn = None
-    if git in ('yes', 'no'):
-        diffopts.git = git == 'yes'
+    if git in (b'yes', b'no'):
+        diffopts.git = git == b'yes'
         diffopts.upgrade = False
-    elif git == 'auto':
+    elif git == b'auto':
         diffopts.git = False
         diffopts.upgrade = True
-    elif git == 'warn':
+    elif git == b'warn':
         diffopts.git = False
         diffopts.upgrade = True
         def losedatafn(fn=None, **kwargs):
             brokenfiles.add(fn)
             return True
-    elif git == 'abort':
+    elif git == b'abort':
         diffopts.git = False
         diffopts.upgrade = True
         def losedatafn(fn=None, **kwargs):
-            raise error.Abort('losing data for %s' % fn)
+            raise error.Abort(b'losing data for %s' % fn)
     else:
-        raise error.Abort('--git must be yes, no or auto')
+        raise error.Abort(b'--git must be yes, no or auto')
 
     node1, node2 = scmutil.revpair(repo, [])
     m = scmutil.match(repo[node2], pats, opts)
     it = patch.diff(repo, node1, node2, match=m, opts=diffopts,
                     losedatafn=losedatafn)
     for chunk in it:
         ui.write(chunk)
     for fn in sorted(brokenfiles):
-        ui.write(('data lost for: %s\n' % fn))
+        ui.write((b'data lost for: %s\n' % fn))