Patchwork terse: pconvert() entries added to the temporary terse dict for Windows

login
register
mail settings
Submitter Matt Harbison
Date May 23, 2018, 3:43 a.m.
Message ID <a6bed2a6eafea7d89af7.1527047004@Envy>
Download mbox | patch
Permalink /patch/31817/
State Accepted
Headers show

Comments

Matt Harbison - May 23, 2018, 3:43 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1527045735 14400
#      Tue May 22 23:22:15 2018 -0400
# Node ID a6bed2a6eafea7d89af7e12696169c754c9bf64a
# Parent  c65931d23baf101780d00f027bf57dbe0af5e8cc
terse: pconvert() entries added to the temporary terse dict for Windows

Recent additional testing revealed this problem on Windows:

  --- tests/test-status.t.err
  +++ tests/test-status.t.err
  @@ -109,7 +109,7 @@

   tweaking defaults works
     $ hg status --cwd a --config ui.tweakdefaults=yes
  -  ? .
  +  ? ../a/
     ? ../b/
     ? ../in_root
     $ HGPLAIN=1 hg status --cwd a --config ui.tweakdefaults=yes
  @@ -120,7 +120,7 @@
     ? b/in_b (glob)
     ? in_root
     $ HGPLAINEXCEPT=tweakdefaults hg status --cwd a --config ui.tweakdefaults=yes
  -  ? .
  +  ? ..\a\
     ? ../b/
     ? ../in_root (glob)

AFAICT, the status list (input and output here) is always in '/' format.  The
'\' printed output on Windows is because each file is run through repo.pathto()
-> dirstate.pathto() -> util.pathto().  (And that function states that the
argument uses '/' separators.)

I fixed a similar issue in 362096cfdb1f, and given the apparent need for these
strings to be in '/' format, I wonder if cmdutil.dirnode() should be rewritten
to avoid os.path.join().  But it looks like all entries added to the temporary
terse dict should use '/' now, and cmdutil.tersedir() looks like the only user.
Yuya Nishihara - May 25, 2018, 12:24 p.m.
On Tue, 22 May 2018 23:43:24 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1527045735 14400
> #      Tue May 22 23:22:15 2018 -0400
> # Node ID a6bed2a6eafea7d89af7e12696169c754c9bf64a
> # Parent  c65931d23baf101780d00f027bf57dbe0af5e8cc
> terse: pconvert() entries added to the temporary terse dict for Windows

Queued, thanks.

> I fixed a similar issue in 362096cfdb1f, and given the apparent need for these
> strings to be in '/' format, I wonder if cmdutil.dirnode() should be rewritten
> to avoid os.path.join().  But it looks like all entries added to the temporary
> terse dict should use '/' now, and cmdutil.tersedir() looks like the only user.
> 
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -552,7 +552,7 @@ def tersedir(statuslist, terseargs):
>      # process each sub-directory and build tersedict
>      for subdir in rootobj.subdirs.values():
>          for st, f in subdir.tersewalk(terseargs):
> -            tersedict[st].append(f)
> +            tersedict[st].append(util.pconvert(f))

I suspect the use of ossep in tersewalk() would be wrong if it's designed to
work with the internal paths.
Matt Harbison - May 25, 2018, 10:31 p.m.
On Fri, 25 May 2018 08:24:01 -0400, Yuya Nishihara <yuya@tcha.org> wrote:

> On Tue, 22 May 2018 23:43:24 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison@yahoo.com>
>> # Date 1527045735 14400
>> #      Tue May 22 23:22:15 2018 -0400
>> # Node ID a6bed2a6eafea7d89af7e12696169c754c9bf64a
>> # Parent  c65931d23baf101780d00f027bf57dbe0af5e8cc
>> terse: pconvert() entries added to the temporary terse dict for Windows
>
> Queued, thanks.

It looks like it didn't make it to hg-committed.
Yuya Nishihara - May 26, 2018, 1:26 a.m.
On Fri, 25 May 2018 18:31:03 -0400, Matt Harbison wrote:
> On Fri, 25 May 2018 08:24:01 -0400, Yuya Nishihara <yuya@tcha.org> wrote:
> > On Tue, 22 May 2018 23:43:24 -0400, Matt Harbison wrote:
> >> # HG changeset patch
> >> # User Matt Harbison <matt_harbison@yahoo.com>
> >> # Date 1527045735 14400
> >> #      Tue May 22 23:22:15 2018 -0400
> >> # Node ID a6bed2a6eafea7d89af7e12696169c754c9bf64a
> >> # Parent  c65931d23baf101780d00f027bf57dbe0af5e8cc
> >> terse: pconvert() entries added to the temporary terse dict for Windows
> >
> > Queued, thanks.
> 
> It looks like it didn't make it to hg-committed.

Oops, pushed.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -552,7 +552,7 @@  def tersedir(statuslist, terseargs):
     # process each sub-directory and build tersedict
     for subdir in rootobj.subdirs.values():
         for st, f in subdir.tersewalk(terseargs):
-            tersedict[st].append(f)
+            tersedict[st].append(util.pconvert(f))
 
     tersedlist = []
     for st in allst: