D5107: localrepo: ensure we properly %-format ints vs strings in exception throw

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

D5107: localrepo: ensure we properly %-format ints vs strings in exception throw

martinvonz (Martin von Zweigbergk)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'm not thrilled with this, but it'll do.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1282,6 +1282,9 @@
             raise error.FilteredRepoLookupError(_("filtered revision '%s'")
                                                 % pycompat.bytestr(changeid))
         except (IndexError, LookupError):
+            if isinstance(changeid, int):
+                raise error.RepoLookupError(
+                    _("unknown revision '%d'") % changeid)
             raise error.RepoLookupError(_("unknown revision '%s'") % changeid)
         except error.WdirUnsupported:
             return context.workingctx(self)



To: durin42, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: D5107: localrepo: ensure we properly %-format ints vs strings in exception throw

Yuya Nishihara
>              raise error.FilteredRepoLookupError(_("filtered revision '%s'")
>                                                  % pycompat.bytestr(changeid))
>          except (IndexError, LookupError):
> +            if isinstance(changeid, int):
> +                raise error.RepoLookupError(
> +                    _("unknown revision '%d'") % changeid)
>              raise error.RepoLookupError(_("unknown revision '%s'") % changeid)

Use `pycompat.bytestr(changeid)`? It's worked around as such just a few lines
above.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D5107: localrepo: ensure we properly %-format ints vs strings in exception throw

martinvonz (Martin von Zweigbergk)
yuja added a comment.


  >       raise error.FilteredRepoLookupError(_("filtered revision '%s'")
  >                                           % pycompat.bytestr(changeid))
  >   except (IndexError, LookupError):
  >
  > +            if isinstance(changeid, int):
  >  +                raise error.RepoLookupError(
  >  +                    _("unknown revision '%d'") % changeid)
  >
  >   raise error.RepoLookupError(_("unknown revision '%s'") % changeid)
 
  Use `pycompat.bytestr(changeid)`? It's worked around as such just a few lines
  above.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D5107: localrepo: ensure we properly %-format int in exception throw

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
durin42 updated this revision to Diff 12173.
durin42 retitled this revision from "localrepo: ensure we properly %-format ints vs strings in exception throw" to "localrepo: ensure we properly %-format int in exception throw".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5107?vs=12139&id=12173

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1282,7 +1282,8 @@
             raise error.FilteredRepoLookupError(_("filtered revision '%s'")
                                                 % pycompat.bytestr(changeid))
         except (IndexError, LookupError):
-            raise error.RepoLookupError(_("unknown revision '%s'") % changeid)
+            raise error.RepoLookupError(
+                _("unknown revision '%s'") % pycompat.bytestr(changeid))
         except error.WdirUnsupported:
             return context.workingctx(self)
 



To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D5107: localrepo: ensure we properly %-format int in exception throw

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa2ebdca4d10e: localrepo: ensure we properly %-format int in exception throw (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5107?vs=12173&id=12243

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1282,7 +1282,8 @@
             raise error.FilteredRepoLookupError(_("filtered revision '%s'")
                                                 % pycompat.bytestr(changeid))
         except (IndexError, LookupError):
-            raise error.RepoLookupError(_("unknown revision '%s'") % changeid)
+            raise error.RepoLookupError(
+                _("unknown revision '%s'") % pycompat.bytestr(changeid))
         except error.WdirUnsupported:
             return context.workingctx(self)
 



To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel