##// END OF EJS Templates
Always show short help when an unknown command is given.
Thomas Arendsen Hein -
r848:221628fe default
parent child Browse files
Show More
@@ -287,7 +287,6 b' def show_version(ui):'
287 def help_(ui, cmd=None):
287 def help_(ui, cmd=None):
288 """show help for a given command or all commands"""
288 """show help for a given command or all commands"""
289 if cmd and cmd != 'shortlist':
289 if cmd and cmd != 'shortlist':
290 try:
291 i = find(cmd)
290 i = find(cmd)
292 ui.write("%s\n\n" % i[2])
291 ui.write("%s\n\n" % i[2])
293
292
@@ -306,8 +305,6 b' def help_(ui, cmd=None):'
306 ui.write("\n")
305 ui.write("\n")
307
306
308 ui.write(i[0].__doc__, "\n")
307 ui.write(i[0].__doc__, "\n")
309 except UnknownCommand:
310 ui.warn("hg: unknown command %s\n" % cmd)
311 sys.exit(0)
308 sys.exit(0)
312 else:
309 else:
313 if ui.verbose:
310 if ui.verbose:
@@ -1401,12 +1398,12 b' def dispatch(args):'
1401 help_(u, inst.args[0])
1398 help_(u, inst.args[0])
1402 else:
1399 else:
1403 u.warn("hg: %s\n" % inst.args[1])
1400 u.warn("hg: %s\n" % inst.args[1])
1404 help_(u)
1401 help_(u, 'shortlist')
1405 sys.exit(-1)
1402 sys.exit(-1)
1406 except UnknownCommand, inst:
1403 except UnknownCommand, inst:
1407 u = ui.ui()
1404 u = ui.ui()
1408 u.warn("hg: unknown command '%s'\n" % inst.args[0])
1405 u.warn("hg: unknown command '%s'\n" % inst.args[0])
1409 help_(u)
1406 help_(u, 'shortlist')
1410 sys.exit(1)
1407 sys.exit(1)
1411
1408
1412 if options["time"]:
1409 if options["time"]:
@@ -1491,5 +1488,8 b' def dispatch(args):'
1491 u.debug(inst, "\n")
1488 u.debug(inst, "\n")
1492 u.warn("%s: invalid arguments\n" % cmd)
1489 u.warn("%s: invalid arguments\n" % cmd)
1493 help_(u, cmd)
1490 help_(u, cmd)
1491 except UnknownCommand, inst:
1492 u.warn("hg: unknown command '%s'\n" % inst.args[0])
1493 help_(u, 'shortlist')
1494
1494
1495 sys.exit(-1)
1495 sys.exit(-1)
@@ -104,42 +104,40 b' hg diff [-r REV1 [-r REV2]] [FILE]...'
104
104
105 diff working directory (or selected files)
105 diff working directory (or selected files)
106 + hg help foo
106 + hg help foo
107 hg: unknown command foo
107 hg: unknown command 'foo'
108 + hg -q commands
108 basic hg commands (use "hg help" for more):
109 hg: unknown command 'commands'
109
110 add add the specified files on the next commit
110 add add the specified files on the next commit
111 addremove add all new files, delete all missing files
112 annotate show changeset information per file line
111 annotate show changeset information per file line
113 cat output the latest or given revision of a file
114 clone make a copy of an existing repository
112 clone make a copy of an existing repository
115 commit commit the specified files or all outstanding changes
113 commit commit the specified files or all outstanding changes
116 copy mark a file as copied or renamed for the next commit
117 diff diff working directory (or selected files)
114 diff diff working directory (or selected files)
118 export dump the header and diffs for one or more changesets
115 export dump the header and diffs for one or more changesets
119 forget don't add the specified files on the next commit
120 heads show current repository heads
121 help show help for a given command or all commands
122 identify print information about the working copy
123 import import an ordered set of patches
124 init create a new repository in the current directory
116 init create a new repository in the current directory
125 locate locate files matching specific patterns
126 log show the revision history of the repository or a single file
117 log show the revision history of the repository or a single file
127 manifest output the latest or given revision of the project manifest
128 parents show the parents of the working dir or revision
129 paths show path or list of available paths
130 pull pull changes from the specified source
118 pull pull changes from the specified source
131 push push changes to the specified destination
119 push push changes to the specified destination
132 rawcommit raw commit interface
133 recover roll back an interrupted transaction
134 remove remove the specified files on the next commit
120 remove remove the specified files on the next commit
135 revert revert modified files or dirs back to their unmodified states
121 revert revert modified files or dirs back to their unmodified states
136 root print the root (top) of the current working dir
137 serve export the repository via HTTP
122 serve export the repository via HTTP
138 status show changed files in the working directory
123 status show changed files in the working directory
139 tag add a tag for the current tip or a given revision
140 tags list repository tags
141 tip show the tip revision
142 undo undo the last commit or pull
143 update update or merge working directory
124 update update or merge working directory
144 verify verify the integrity of the repository
125 + hg -q commands
145 version output version and copyright information
126 hg: unknown command 'commands'
127 basic hg commands (use "hg help" for more):
128
129 add add the specified files on the next commit
130 annotate show changeset information per file line
131 clone make a copy of an existing repository
132 commit commit the specified files or all outstanding changes
133 diff diff working directory (or selected files)
134 export dump the header and diffs for one or more changesets
135 init create a new repository in the current directory
136 log show the revision history of the repository or a single file
137 pull pull changes from the specified source
138 push push changes to the specified destination
139 remove remove the specified files on the next commit
140 revert revert modified files or dirs back to their unmodified states
141 serve export the repository via HTTP
142 status show changed files in the working directory
143 update update or merge working directory
General Comments 0
You need to be logged in to leave comments. Login now