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

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Jan 10 23:03:49 UTC 2018


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

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)
 
- at command('autodiff',
-    [('', 'git', '', 'git upgrade mode (yes/no/auto/warn/abort)')],
-    '[OPTION]... [FILE]...')
+ at 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))



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


More information about the Mercurial-devel mailing list