morestatus: make conflict paths relative

Summary: morestatus: make conflict paths relative

Test Plan: Output: https://phabricator.intern.facebook.com/P57402806

Reviewers: rmcelroy, mgorven

Differential Revision: https://phabricator.intern.facebook.com/D5062074

Tasks: 10366065
This commit is contained in:
Rainer Alves 2017-05-17 07:13:41 -07:00
parent 5bb6893d41
commit 37fdd68496
2 changed files with 22 additions and 1 deletions

View File

@ -10,6 +10,7 @@ This extension will wrap the status command to make it show more context about
the state of the repo
"""
import os
from mercurial import commands
from mercurial.extensions import wrapcommand
from mercurial.i18n import _
@ -33,7 +34,10 @@ def conflictsmsg(repo, ui):
m = scmutil.match(repo[None])
unresolvedlist = [f for f in mergestate if m(f) and mergestate[f] == 'u']
if unresolvedlist:
mergeliststr = '\n'.join([' %s' % path for path in unresolvedlist])
mergeliststr = '\n'.join(
[' %s' % os.path.relpath(
os.path.join(repo.root, path),
os.getcwd()) for path in unresolvedlist])
msg = _('''Unresolved merge conflicts:
%s

View File

@ -196,6 +196,23 @@ Test conflicted merge state
# To continue: hg commit
# To abort: hg update --clean . (warning: this will discard uncommitted changes)
Test if listed files have a relative path to current location
$ mkdir -p b/c
$ cd b/c
$ hg status
M a
? a.orig
# The repository is in an unfinished *merge* state.
# Unresolved merge conflicts:
#
# ../../a
#
# To mark files as resolved: hg resolve --mark FILE
# To continue: hg commit
# To abort: hg update --clean . (warning: this will discard uncommitted changes)
$ cd ../..
Test hg status is normal after merge abort
$ hg update --clean -q
$ hg status