{"record":{"id":"397469b951ba4175","repo":"pcottle/learnGitBranching","slug":"hg-error-log-no-follow","errorCode":null,"errorMessage":"hg-error-log-no-follow","messagePattern":"hg-error-log-no-follow","errorType":"exception","errorClass":"GitError","httpStatus":null,"severity":"warning","filePath":"src/js/mercurial/commands.js","lineNumber":80,"sourceCode":"      return {\n        vcs: 'git',\n        name: 'cherrypick'\n      };\n    }\n  },\n\n  log: {\n    regex: /^hg +log($|\\s)/,\n    options: [\n      '-f'\n    ],\n    dontCountForGolf: true,\n    delegate: function(engine, command) {\n      var options = command.getOptionsMap();\n      command.acceptNoGeneralArgs();\n\n      if (!options['-f']) {\n        throw new GitError({\n          msg: intl.str('hg-error-log-no-follow')\n        });\n      }\n      command.mapDotToHead();\n      return {\n        vcs: 'git',\n        name: 'log'\n      };\n    }\n  },\n\n  bookmark: {\n    regex: /^hg (bookmarks|bookmark|book)($|\\s)/,\n    options: [\n      '-r',\n      '-f',\n      '-d'\n    ],","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/mercurial/commands.js#L62-L98","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nhg log\n// after\nhg log -f","handlingStrategy":"validation","validationCode":"const m = cmd.match(/^hg +log(.*)$/);\nif (m && !/(^|\\s)-f(\\s|$)/.test(m[1])) { inform('use hg log -f'); }","typeGuard":null,"tryCatchPattern":"try { run('hg log'); } catch (e) { if (e instanceof GitError) { suggest('hg log -f'); } else throw e; }","preventionTips":["Always pass -f with hg log in mercurial mode","Teach users that hg log mirrors git log only with follow enabled"],"tags":["mercurial","hg-log","option-required"],"backgroundTag":"missing-required-flag","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}