D2535: py3: use pycompat.bytestr() to convert error messages to bytes

2018-03-03 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2f7a3c90c0d7: py3: use pycompat.bytestr() to convert error 
messages to bytes (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2535?vs=6433=6464

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

AFFECTED FILES
  hgext/gpg.py
  hgext/journal.py
  hgext/largefiles/overrides.py

CHANGE DETAILS

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -598,7 +598,7 @@
 try:
 result = orig(ui, repo, pats, opts, rename)
 except error.Abort as e:
-if str(e) != _('no files to copy'):
+if pycompat.bytestr(e) != _('no files to copy'):
 raise e
 else:
 nonormalfiles = True
@@ -705,7 +705,7 @@
 lfdirstate.add(destlfile)
 lfdirstate.write()
 except error.Abort as e:
-if str(e) != _('no files to copy'):
+if pycompat.bytestr(e) != _('no files to copy'):
 raise e
 else:
 nolfiles = True
diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -508,7 +508,7 @@
 ctx = repo[hash]
 displayer.show(ctx)
 except error.RepoLookupError as e:
-fm.write('repolookuperror', "%s\n\n", str(e))
+fm.write('repolookuperror', "%s\n\n", pycompat.bytestr(e))
 displayer.close()
 
 fm.end()
diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -318,7 +318,7 @@
 repo.commit(message, opts['user'], opts['date'], match=msigs,
 editor=editor)
 except ValueError as inst:
-raise error.Abort(str(inst))
+raise error.Abort(pycompat.bytestr(inst))
 
 def node2txt(repo, node, ver):
 """map a manifest into some text"""



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


D2535: py3: use pycompat.bytestr() to convert error messages to bytes

2018-03-03 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 6433.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2535?vs=6320=6433

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

AFFECTED FILES
  hgext/gpg.py
  hgext/journal.py
  hgext/largefiles/overrides.py

CHANGE DETAILS

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -598,7 +598,7 @@
 try:
 result = orig(ui, repo, pats, opts, rename)
 except error.Abort as e:
-if str(e) != _('no files to copy'):
+if pycompat.bytestr(e) != _('no files to copy'):
 raise e
 else:
 nonormalfiles = True
@@ -705,7 +705,7 @@
 lfdirstate.add(destlfile)
 lfdirstate.write()
 except error.Abort as e:
-if str(e) != _('no files to copy'):
+if pycompat.bytestr(e) != _('no files to copy'):
 raise e
 else:
 nolfiles = True
diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -508,7 +508,7 @@
 ctx = repo[hash]
 displayer.show(ctx)
 except error.RepoLookupError as e:
-fm.write('repolookuperror', "%s\n\n", str(e))
+fm.write('repolookuperror', "%s\n\n", pycompat.bytestr(e))
 displayer.close()
 
 fm.end()
diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -318,7 +318,7 @@
 repo.commit(message, opts['user'], opts['date'], match=msigs,
 editor=editor)
 except ValueError as inst:
-raise error.Abort(str(inst))
+raise error.Abort(pycompat.bytestr(inst))
 
 def node2txt(repo, node, ver):
 """map a manifest into some text"""



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


D2535: py3: use pycompat.bytestr() to convert error messages to bytes

2018-03-02 Thread yuja (Yuya Nishihara)
yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.


  Some of them have to be forcebytestr().

REPOSITORY
  rHG Mercurial

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

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


D2535: py3: use pycompat.bytestr() to convert error messages to bytes

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

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/convert/subversion.py
  hgext/gpg.py
  hgext/journal.py
  hgext/largefiles/overrides.py
  hgext/mq.py
  hgext/narrow/narrowbundle2.py
  hgext/relink.py

CHANGE DETAILS

diff --git a/hgext/relink.py b/hgext/relink.py
--- a/hgext/relink.py
+++ b/hgext/relink.py
@@ -187,7 +187,7 @@
 relinked += 1
 savedbytes += sz
 except OSError as inst:
-ui.warn('%s: %s\n' % (tgt, str(inst)))
+ui.warn('%s: %s\n' % (tgt, pycompat.bytestr(inst)))
 
 ui.progress(_('relinking'), None)
 
diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -25,6 +25,7 @@
 exchange,
 extensions,
 narrowspec,
+pycompat,
 repair,
 util,
 wireproto,
@@ -449,7 +450,7 @@
 except OSError as e:
 if e.errno != errno.ENOENT:
 ui.warn(_('error removing %s: %s\n') %
-(undovfs.join(undofile), str(e)))
+(undovfs.join(undofile), pycompat.bytestr(e)))
 
 # Remove partial backup only if there were no exceptions
 vfs.unlink(chgrpfile)
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -722,7 +722,8 @@
 try:
 os.unlink(undo)
 except OSError as inst:
-self.ui.warn(_('error removing undo: %s\n') % str(inst))
+self.ui.warn(_('error removing undo: %s\n') % \
+ pycompat.bytestr(inst))
 
 def backup(self, repo, files, copy=False):
 # backup local changes in --force case
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -598,7 +598,7 @@
 try:
 result = orig(ui, repo, pats, opts, rename)
 except error.Abort as e:
-if str(e) != _('no files to copy'):
+if pycompat.bytestr(e) != _('no files to copy'):
 raise e
 else:
 nonormalfiles = True
@@ -705,7 +705,7 @@
 lfdirstate.add(destlfile)
 lfdirstate.write()
 except error.Abort as e:
-if str(e) != _('no files to copy'):
+if pycompat.bytestr(e) != _('no files to copy'):
 raise e
 else:
 nolfiles = True
diff --git a/hgext/journal.py b/hgext/journal.py
--- a/hgext/journal.py
+++ b/hgext/journal.py
@@ -507,7 +507,7 @@
 ctx = repo[hash]
 displayer.show(ctx)
 except error.RepoLookupError as e:
-fm.write('repolookuperror', "%s\n\n", str(e))
+fm.write('repolookuperror', "%s\n\n", pycompat.bytestr(e))
 displayer.close()
 
 fm.end()
diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -317,7 +317,7 @@
 repo.commit(message, opts['user'], opts['date'], match=msigs,
 editor=editor)
 except ValueError as inst:
-raise error.Abort(str(inst))
+raise error.Abort(pycompat.bytestr(inst))
 
 def node2txt(repo, node, ver):
 """map a manifest into some text"""
diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -146,7 +146,7 @@
 # Caller may interrupt the iteration
 pickle.dump(None, fp, protocol)
 except Exception as inst:
-pickle.dump(str(inst), fp, protocol)
+pickle.dump(pycompat.bytestr(inst), fp, protocol)
 else:
 pickle.dump(None, fp, protocol)
 fp.flush()



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