Patchwork [STABLE] byteify-string: resolve symlink because byteifying

login
register
mail settings
Submitter Pierre-Yves David
Date March 19, 2020, 8:25 p.m.
Message ID <6409ccedfa1ae7e0df8c.1584649534@nodosa.octobus.net>
Download mbox | patch
Permalink /patch/45835/
State Accepted
Headers show

Comments

Pierre-Yves David - March 19, 2020, 8:25 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1584563265 -3600
#      Wed Mar 18 21:27:45 2020 +0100
# Branch stable
# Node ID 6409ccedfa1ae7e0df8cd5a9228ba5fdf0d550c9
# Parent  864e9534d3d4f984e9c50a40e812e844816847bc
# EXP-Topic no-bytify-symlink
# Available At https://dev.heptapod.net/octobus/mercurial-devel/
#              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r 6409ccedfa1a
byteify-string: resolve symlink because byteifying

Otherwise the script turn symlink into regular file.
Augie Fackler - March 19, 2020, 8:36 p.m.
queued for stable with some log message rewording

> On Mar 19, 2020, at 16:25, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:
> 
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1584563265 -3600
> #      Wed Mar 18 21:27:45 2020 +0100
> # Branch stable
> # Node ID 6409ccedfa1ae7e0df8cd5a9228ba5fdf0d550c9
> # Parent  864e9534d3d4f984e9c50a40e812e844816847bc
> # EXP-Topic no-bytify-symlink
> # Available At https://dev.heptapod.net/octobus/mercurial-devel/
> #              hg pull https://dev.heptapod.net/octobus/mercurial-devel/ -r 6409ccedfa1a
> byteify-string: resolve symlink because byteifying
> 
> Otherwise the script turn symlink into regular file.
> 
> diff --git a/contrib/byteify-strings.py b/contrib/byteify-strings.py
> --- a/contrib/byteify-strings.py
> +++ b/contrib/byteify-strings.py
> @@ -328,6 +328,7 @@ def main():
>         'allow-attr-methods': args.allow_attr_methods,
>     }
>     for fname in args.files:
> +        fname = os.path.realpath(fname)
>         if args.inplace:
>             with editinplace(fname) as fout:
>                 with open(fname, 'rb') as fin:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/contrib/byteify-strings.py b/contrib/byteify-strings.py
--- a/contrib/byteify-strings.py
+++ b/contrib/byteify-strings.py
@@ -328,6 +328,7 @@  def main():
         'allow-attr-methods': args.allow_attr_methods,
     }
     for fname in args.files:
+        fname = os.path.realpath(fname)
         if args.inplace:
             with editinplace(fname) as fout:
                 with open(fname, 'rb') as fin: