# HG changeset patch # User Matt Harbison # Date 2018-05-22 02:32:15 # Node ID d8bd6a9c64a57402715a65cebb269b2adb370f48 # Parent 69ec6f98cfa6b79d456543371da9828756394124 githelp: fail gracefully in a couple cases where arguments are missing I didn't bother adding tests because the other commands that already handled missing arguments don't test these edge cases. I didn't read over all of the code, rather I scanned for `args` not being checked before indexing. diff --git a/hgext/githelp.py b/hgext/githelp.py --- a/hgext/githelp.py +++ b/hgext/githelp.py @@ -236,6 +236,8 @@ def branch(ui, repo, *args, **kwargs): # shell command to output the active bookmark for the active # revision old = '`hg log -T"{activebookmark}" -r .`' + else: + raise error.Abort(_('missing newbranch argument')) new = args[0] cmd['-m'] = old cmd.append(new) @@ -957,6 +959,8 @@ def status(ui, repo, *args, **kwargs): ui.status((bytes(cmd)), "\n") def svn(ui, repo, *args, **kwargs): + if not args: + raise error.Abort(_('missing svn command')) svncmd = args[0] if not svncmd in gitsvncommands: ui.warn(_("error: unknown git svn command %s\n") % (svncmd)) @@ -988,6 +992,9 @@ def svnfindrev(ui, repo, *args, **kwargs ] args, opts = parseoptions(ui, cmdoptions, args) + if not args: + raise error.Abort(_('missing find-rev argument')) + cmd = Command('log') cmd['-r'] = args[0] @@ -1020,6 +1027,10 @@ def tag(ui, repo, *args, **kwargs): cmd = Command('tags') else: cmd = Command('tag') + + if not args: + raise error.Abort(_('missing tag argument')) + cmd.append(args[0]) if len(args) > 1: cmd['-r'] = args[1]