Closed Bug 2004368 Opened 10 months ago Closed 4 months ago

moz-phab patch -a here with jj says there is no source tree if jj config is broken

Categories

(Conduit :: moz-phab, defect, P3)

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: Gijs, Assigned: sheehan)

Details

Attachments

(1 file)

moz-phab version (from moz-phab version): 2.8.0

STR:

  1. use a jj workspace for your tree.
  2. break your jj config (jj config edit --repo). E.g. in something like this:
"immutable_heads()" = '''
builtin_immutable_heads()
| remote_bookmarks(exact:'autoland')
| remote_bookmarks(exact:'beta')
| remote_bookmarks(regex:'^esr\d+$')
| remote_bookmarks(exact:'release')
'''

accidentally introduce another quote

  1. run jj status to confirm. It should complain, something like:
jj status     
Config error: Invalid `revset-aliases.immutable_heads()`
Caused by:  --> 4:29
  1. try to run moz-phab patch -a here D123456

ER:
similar error to jj status

AR:

Not a repository (or any of the parent directories): .hg / .jj / .git

Which is confusing because .jj exists.

Can you paste your moz-phab output (maybe with DEBUG=1 in the environment) so we can see more details?

Any idea if jj fails for every command or just jj status when the config is busted? If it fails for any command, perhaps we could run a cheap sanity-check jj <cheap command> when we build the Jujutsu object to detect this.

Severity: -- → S4
Flags: needinfo?(gijskruitbosch+bugs)
Priority: -- → P3

With apologies for the silly delay here, this got lost... 😢

(In reply to Connor Sheehan [:sheehan] from comment #1)

Can you paste your moz-phab output (maybe with DEBUG=1 in the environment) so we can see more details?

% DEBUG=1 moz-phab patch -a here D123556  
DEBUG    2025-12-23 23:19:09,047 MozPhab (2.8.1)
DEBUG    2025-12-23 23:19:09,047 Forced update check: False.
DEBUG    2025-12-23 23:19:09,047 Time since last check is 101 seconds, skipping check for new versions.
DEBUG    2025-12-23 23:19:09,047 Not checking for updates.
DEBUG    2025-12-23 23:19:09,047 found Jujutsu repo in path/to/worktree/
DEBUG    2025-12-23 23:19:09,047 $ jj version
DEBUG    2025-12-23 23:19:09,059 jj 0.36.0
DEBUG    2025-12-23 23:19:09,060 resolved_path: path/to/worktree/
DEBUG    2025-12-23 23:19:09,060 $ jj git root
DEBUG    2025-12-23 23:19:09,086 Config error: Invalid `revset-aliases.immutable_heads()`
Caused by:  --> 5:27
  |
5 | | remote_bookmarks(exact:'release')
  |                           ^---
  |
  = expected `-`, `+`, `::`, `..`, `|`, `&`, or `~`
For help, see https://docs.jj-vcs.dev/latest/config/ or use `jj help -k config`.

ERROR    2025-12-23 23:19:09,086 Not a repository (or any of the parent directories): .hg / .jj / .git

Any idea if jj fails for every command or just jj status when the config is busted? If it fails for any command, perhaps we could run a cheap sanity-check jj <cheap command> when we build the Jujutsu object to detect this.

Well! Fun fun, the above log output suggests that we do actually know there's a jj repo, we just... forget when the command fails? 😬

Trying in the non-worktree copy of this repo, with the same broken config, the debug output is:

% DEBUG=1 moz-phab patch -a here D123456 
DEBUG    2025-12-23 23:21:06,190 MozPhab (2.8.1)
DEBUG    2025-12-23 23:21:06,190 Forced update check: False.
DEBUG    2025-12-23 23:21:06,190 Time since last check is 218 seconds, skipping check for new versions.
DEBUG    2025-12-23 23:21:06,190 Not checking for updates.
DEBUG    2025-12-23 23:21:06,190 found Jujutsu repo in path/to/repo
DEBUG    2025-12-23 23:21:06,190 $ jj version
DEBUG    2025-12-23 23:21:06,202 jj 0.36.0
DEBUG    2025-12-23 23:21:06,203 resolved_path: path/to/repo
DEBUG    2025-12-23 23:21:06,203 $ jj git root
DEBUG    2025-12-23 23:21:06,229 Config error: Invalid `revset-aliases.immutable_heads()`
Caused by:  --> 5:27
  |
5 | | remote_bookmarks(exact:'release')
  |                           ^---
  |
  = expected `-`, `+`, `::`, `..`, `|`, `&`, or `~`
For help, see https://docs.jj-vcs.dev/latest/config/ or use `jj help -k config`.

DEBUG    2025-12-23 23:21:06,230 found git repo in path/to/repo
DEBUG    2025-12-23 23:21:06,230 $ git -c i18n.logOutputEncoding=UTF-8 -c i18n.commitEncoding=UTF-8 --version
DEBUG    2025-12-23 23:21:06,247 git version 2.50.1 (Apple Git-155)
DEBUG    2025-12-23 23:21:06,247 $ git -c i18n.logOutputEncoding=UTF-8 -c i18n.commitEncoding=UTF-8 config --list
DEBUG    2025-12-23 23:21:06,316 Initializing Glean...
DEBUG    2025-12-23 23:21:06,350 $ git -c i18n.logOutputEncoding=UTF-8 -c i18n.commitEncoding=UTF-8 status --porcelain
DEBUG    2025-12-23 23:21:07,750  A moz_src_stats_931471037b8a4f16ce3ccfa864310540cac255c1.json
 A mozbuild_vs_js_modules_actors_stats.py
DEBUG    2025-12-23 23:21:07,750 $ git -c i18n.logOutputEncoding=UTF-8 -c i18n.commitEncoding=UTF-8 gc --auto --quiet
ERROR    2025-12-23 23:21:07,769 Uncommitted changes present. Please stash them or commit before patching.

(the uncommitted changes thing is not related, but I guess it would just fall back to using git now that it's realized there's also a git repo?)

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(sheehan)

To be clear, without DEBUG=1, the only final moz-phab output (as moz-phab rewrites lines while making progress) is what is already in comment 0:

Not a repository (or any of the parent directories): .hg / .jj / .git

A jj git root failure when .jj exists was swallowed as a ValueError
and misreported as "Not a repository". Raise Error with the underlying
jj stderr so a broken config is shown to the user.

Assignee: nobody → sheehan
Status: NEW → ASSIGNED

Sorry for the delay, Gijs! This fell through the cracks. I have a patch up that should resolve this, I tagged you for review if you want to give it a try and confirm it works.

Flags: needinfo?(sheehan)
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED

Sorry for not responding to the review request, never saw it in my queue as everyone else reviewed too quickly (lovely problem to have 😉).

I can confirm that this fixes it for me on 2.15.2 🎉

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: