pcottle/learnGitBranching · warning · GitError
hg-error-log-no-follow
Error message
hg-error-log-no-follow
What it means
In mercurial mode, `hg log` is only implemented as a delegation to the git log machinery after rewriting '.' to HEAD, and that delegation requires the -f (follow) option. Without -f the command throws a GitError with 'hg-error-log-no-follow'.
Source
Thrown at src/js/mercurial/commands.js:80
return {
vcs: 'git',
name: 'cherrypick'
};
}
},
log: {
regex: /^hg +log($|\s)/,
options: [
'-f'
],
dontCountForGolf: true,
delegate: function(engine, command) {
var options = command.getOptionsMap();
command.acceptNoGeneralArgs();
if (!options['-f']) {
throw new GitError({
msg: intl.str('hg-error-log-no-follow')
});
}
command.mapDotToHead();
return {
vcs: 'git',
name: 'log'
};
}
},
bookmark: {
regex: /^hg (bookmarks|bookmark|book)($|\s)/,
options: [
'-r',
'-f',
'-d'
],View on GitHub (pinned to 5b09d0ff96)
Solutions
- Run `hg log -f` instead of bare `hg log`
- Check your level's expected solution commands if a scripted flow fails here
- Remember this is a simulation limitation, not real hg behavior
Example fix
// before hg log // after hg log -f
Defensive patterns
Strategy: validation
Validate before calling
const m = cmd.match(/^hg +log(.*)$/);
if (m && !/(^|\s)-f(\s|$)/.test(m[1])) { inform('use hg log -f'); } Try / catch
try { run('hg log'); } catch (e) { if (e instanceof GitError) { suggest('hg log -f'); } else throw e; } Prevention
- Always pass -f with hg log in mercurial mode
- Teach users that hg log mirrors git log only with follow enabled
When it happens
Trigger: Running `hg log` without the `-f` flag in hg mode. `command.getOptionsMap()` is inspected; if options['-f'] is falsy the error is raised before `mapDotToHead()` and delegation occur.
Common situations: Users habitually typing `hg log` bare as in real Mercurial; porting git-mode lesson flows (`git log`) to hg mode where follow is mandatory in this simulation.
Related errors
- hg-error-no-status
- -m and -d are incompatible
- -r is incompatible with -d
- -r is incompatible with -m
- git-error-options
AI-assisted analysis of pcottle/learnGitBranching@5b09d0ff96 (2026-08-27).
Data as JSON: /api/errors/397469b951ba4175.
Report an issue: GitHub.