Skip to content

Commit

Permalink
status: fix --no-root-relative Python handling
Browse files Browse the repository at this point in the history
Summary: We have discovered that Python has the same bug fixed in D45717808. Specifically, passing "--no-root-relative" when HGPLAIN=1 still gives you root-relative paths.

Reviewed By: quark-zju

Differential Revision: D57498207

fbshipit-source-id: 679aad796a757fa6afafa13a6443cf2bf53489b0
  • Loading branch information
muirdm authored and facebook-github-bot committed May 17, 2024
1 parent 11ceaf6 commit cea1bc8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
15 changes: 7 additions & 8 deletions eden/scm/sapling/ext/tweakdefaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,11 @@ def statuscmd(orig, ui, repo, *pats, **opts):
message = _("--root-relative not supported with patterns")
hint = _("run from the repo root instead")
raise error.Abort(message, hint=hint)
elif ui.plain():
pass

# Only default rootrel if it wasn't specified by user.
if rootrel is None:
rootrel = ui.plain()

# Here's an ugly hack! If users are passing "re:" to make status relative,
# hgwatchman will never refresh the full state and status will become and
# remain slow after a restart or 24 hours. Here, we check for this and
Expand All @@ -657,14 +660,10 @@ def statuscmd(orig, ui, repo, *pats, **opts):
# only pattern passed.
#
# Also set pats to [''] if pats is empty because that makes status relative.
elif not pats or (len(pats) == 1 and pats[0] == "re:"):
if not rootrel and not pats or (len(pats) == 1 and pats[0] == "re:"):
pats = [""]

with (
ui.configoverride({("commands", "status.relative"): "false"})
if rootrel
else util.nullcontextmanager()
):
with ui.configoverride({("commands", "status.relative"): str(not rootrel)}):
return orig(ui, repo, *pats, **opts)


Expand Down
6 changes: 6 additions & 0 deletions eden/scm/tests/test-fb-ext-tweakdefaults.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#chg-compatible
#debugruntest-incompatible

#testcases ruststatus pythonstatus

#if pythonstatus
$ setconfig status.use-rust=false
#endif

$ setconfig devel.segmented-changelog-rev-compat=true
$ . "$TESTDIR/histedit-helpers.sh"

Expand Down

0 comments on commit cea1bc8

Please sign in to comment.