Patchwork [STABLE] morestatus: don't crash with different drive letters for repo.root and CWD

login
register
mail settings
Submitter Matt Harbison
Date Nov. 6, 2017, 4:52 a.m.
Message ID <0e660095ea2df1f90b38.1509943931@Envy>
Download mbox | patch
Permalink /patch/25407/
State Accepted
Headers show

Comments

Matt Harbison - Nov. 6, 2017, 4:52 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1509853194 14400
#      Sat Nov 04 23:39:54 2017 -0400
# Branch stable
# Node ID 0e660095ea2df1f90b38bdb3942519e15d71a412
# Parent  b64ea7fb95990ef0178bb7b5441088ee582a6483
morestatus: don't crash with different drive letters for repo.root and CWD

Previously, if there were unresolved files and the CWD drive was different from
the repo drive, `hg status -v` would page the normal status, followed by the
exception header.  A stacktrace was waiting when the pager exited.  The
underlying cause was the same as f445b10dc7fb.

Unfortunately, I don't see any reasonable way to write a test this [1].

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-November/107401.html
Yuya Nishihara - Nov. 7, 2017, 12:27 p.m.
On Sun, 05 Nov 2017 23:52:11 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1509853194 14400
> #      Sat Nov 04 23:39:54 2017 -0400
> # Branch stable
> # Node ID 0e660095ea2df1f90b38bdb3942519e15d71a412
> # Parent  b64ea7fb95990ef0178bb7b5441088ee582a6483
> morestatus: don't crash with different drive letters for repo.root and CWD

Queued for stable, thanks.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -570,9 +570,8 @@ 
     unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
     if unresolvedlist:
         mergeliststr = '\n'.join(
-            ['    %s' % os.path.relpath(
-                os.path.join(repo.root, path),
-                pycompat.getcwd()) for path in unresolvedlist])
+            ['    %s' % util.pathto(repo.root, pycompat.getcwd(), path)
+                for path in unresolvedlist])
         msg = _('''Unresolved merge conflicts:
 
 %s