##// 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,27 +287,24 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:
290 i = find(cmd)
291 i = find(cmd)
291 ui.write("%s\n\n" % i[2])
292 ui.write("%s\n\n" % i[2])
293
292
294 if i[1]:
293 if i[1]:
295 for s, l, d, c in i[1]:
294 for s, l, d, c in i[1]:
296 opt = ' '
295 opt = ' '
297 if s:
296 if s:
298 opt = opt + '-' + s + ' '
297 opt = opt + '-' + s + ' '
299 if l:
298 if l:
300 opt = opt + '--' + l + ' '
299 opt = opt + '--' + l + ' '
301 if d:
300 if d:
302 opt = opt + '(' + str(d) + ')'
301 opt = opt + '(' + str(d) + ')'
303 ui.write(opt, "\n")
302 ui.write(opt, "\n")
304 if c:
303 if c:
305 ui.write(' %s\n' % c)
304 ui.write(' %s\n' % c)
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 basic hg commands (use "hg help" for more):
109
110 add add the specified files on the next commit
111 annotate show changeset information per file line
112 clone make a copy of an existing repository
113 commit commit the specified files or all outstanding changes
114 diff diff working directory (or selected files)
115 export dump the header and diffs for one or more changesets
116 init create a new repository in the current directory
117 log show the revision history of the repository or a single file
118 pull pull changes from the specified source
119 push push changes to the specified destination
120 remove remove the specified files on the next commit
121 revert revert modified files or dirs back to their unmodified states
122 serve export the repository via HTTP
123 status show changed files in the working directory
124 update update or merge working directory
108 + hg -q commands
125 + hg -q commands
109 hg: unknown command 'commands'
126 hg: unknown command 'commands'
110 add add the specified files on the next commit
127 basic hg commands (use "hg help" for more):
111 addremove add all new files, delete all missing files
128
112 annotate show changeset information per file line
129 add add the specified files on the next commit
113 cat output the latest or given revision of a file
130 annotate show changeset information per file line
114 clone make a copy of an existing repository
131 clone make a copy of an existing repository
115 commit commit the specified files or all outstanding changes
132 commit commit the specified files or all outstanding changes
116 copy mark a file as copied or renamed for the next commit
133 diff diff working directory (or selected files)
117 diff diff working directory (or selected files)
134 export dump the header and diffs for one or more changesets
118 export dump the header and diffs for one or more changesets
135 init create a new repository in the current directory
119 forget don't add the specified files on the next commit
136 log show the revision history of the repository or a single file
120 heads show current repository heads
137 pull pull changes from the specified source
121 help show help for a given command or all commands
138 push push changes to the specified destination
122 identify print information about the working copy
139 remove remove the specified files on the next commit
123 import import an ordered set of patches
140 revert revert modified files or dirs back to their unmodified states
124 init create a new repository in the current directory
141 serve export the repository via HTTP
125 locate locate files matching specific patterns
142 status show changed files in the working directory
126 log show the revision history of the repository or a single file
143 update update or merge working directory
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
131 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
135 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
138 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
144 verify verify the integrity of the repository
145 version output version and copyright information
General Comments 0
You need to be logged in to leave comments. Login now