{"record":{"id":"ad95e36ccb326811","repo":"pcottle/learnGitBranching","slug":"r-is-incompatible-with-d","errorCode":null,"errorMessage":"-r is incompatible with -d","messagePattern":"-r is incompatible with -d","errorType":"exception","errorClass":"GitError","httpStatus":null,"severity":"error","filePath":"src/js/mercurial/commands.js","lineNumber":113,"sourceCode":"      '-r',\n      '-f',\n      '-d'\n    ],\n    delegate: function(engine, command) {\n      var options = command.getOptionsMap();\n      var generalArgs = command.getGeneralArgs();\n      var branchName;\n      var rev;\n\n      var delegate = {vcs: 'git'};\n\n      if (options['-m'] && options['-d']) {\n        throw new GitError({\n          msg: intl.todo('-m and -d are incompatible')\n        });\n      }\n      if (options['-d'] && options['-r']) {\n        throw new GitError({\n          msg: intl.todo('-r is incompatible with -d')\n        });\n      }\n      if (options['-m'] && options['-r']) {\n        throw new GitError({\n          msg: intl.todo('-r is incompatible with -m')\n        });\n      }\n      if (generalArgs.length + (options['-r'] ? options['-r'].length : 0) +\n          (options['-d'] ? options['-d'].length : 0) === 0) {\n        delegate.name = 'branch';\n        return delegate;\n      }\n\n      if (options['-d']) {\n        options['-D'] = options['-d'];\n        delete options['-d'];\n        delegate.name = 'branch';","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/pcottle/learnGitBranching/blob/5b09d0ff9678cad164f5a7488a279a44f90d7256/src/js/mercurial/commands.js#L95-L131","documentation":"When `hg branch` is given both -d (delete) and -r (rev), the mercurial command shim throws intl.todo('-r is incompatible with -d'). Deletion of a branch cannot be combined with a revision selector in the delegated git model, so the pair is rejected up-front.","triggerScenarios":"Executing `hg branch` (or the branch-shim path) with both -d and -r present in the options map.","commonSituations":"Transcribing real-hg command lines that permit -r with some subcommands; option-combining scripts that don't enforce exclusivity.","solutions":["Drop -r when using -d; delete by branch name instead","Validate the option combination before submitting the command"],"exampleFix":"// before\nhg branch -d -r .\n// after\nhg branch -d branchname","handlingStrategy":"validation","validationCode":"if (options['-d'] && options['-r']) { reject('drop -r when using -d'); }","typeGuard":null,"tryCatchPattern":"try { exec(cmd); } catch (e) { if (e instanceof GitError) { showMsg(e.msg); } else throw e; }","preventionTips":["Delete branches by name, not by revision, in hg mode","Keep -r usage separate from -d/-m operations"],"tags":["mercurial","hg-branch","mutually-exclusive-options"],"backgroundTag":"conflicting-command-options","analyzedSha":"5b09d0ff9678cad164f5a7488a279a44f90d7256","analyzedAt":"2026-08-27T13:53:49.057Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}