##// END OF EJS Templates
Give a friendlier message when repo isn't found
mpm@selenic.com -
r18:2fd3e1e3 default
parent child Browse files
Show More
@@ -18,6 +18,26 b' except:'
18 import sys, os
18 import sys, os
19 from mercurial import hg, mdiff, fancyopts
19 from mercurial import hg, mdiff, fancyopts
20
20
21 def help():
22 print """\
23 commands:
24
25 init create a new repository in this directory
26 branch <path> create a branch of <path> in this directory
27 merge <path> merge changes from <path> into local repository
28 checkout [changeset] checkout the latest or given changeset
29 status show new, missing, and changed files in working dir
30 add [files...] add the given files in the next commit
31 remove [files...] remove the given files in the next commit
32 addremove add all new files, delete all missing files
33 commit commit all changes to the repository
34 history show changeset history
35 log <file> show revision history of a single file
36 dump <file> [rev] dump the latest or given revision of a file
37 dumpmanifest [rev] dump the latest or given revision of the manifest
38 """
39
40
21 options = {}
41 options = {}
22 opts = [('v', 'verbose', None, 'verbose'),
42 opts = [('v', 'verbose', None, 'verbose'),
23 ('d', 'debug', None, 'debug')]
43 ('d', 'debug', None, 'debug')]
@@ -39,8 +59,15 b' if cmd == "init":'
39 elif cmd == "branch" or cmd == "clone":
59 elif cmd == "branch" or cmd == "clone":
40 os.system("cp -al %s/.hg .hg" % args[0])
60 os.system("cp -al %s/.hg .hg" % args[0])
41 sys.exit(0)
61 sys.exit(0)
62 elif cmd == "help":
63 help()
64 sys.exit(0)
42 else:
65 else:
43 repo = hg.repository(ui=ui)
66 try:
67 repo = hg.repository(ui=ui)
68 except:
69 print "Unable to open repository"
70 sys.exit(0)
44
71
45 if cmd == "checkout" or cmd == "co":
72 if cmd == "checkout" or cmd == "co":
46 node = repo.changelog.tip()
73 node = repo.changelog.tip()
@@ -256,24 +283,6 b' elif cmd == "verify":'
256 revisions)
283 revisions)
257
284
258 else:
285 else:
259 if cmd != "help":
286 print "unknown command\n"
260 print "unknown command\n"
287 help()
261
262 print """\
263 commands:
264
265 init create a new repository in this directory
266 branch <path> create a branch of <path> in this directory
267 merge <path> merge changes from <path> into local repository
268 checkout [changeset] checkout the latest or given changeset
269 status show new, missing, and changed files in working dir
270 add [files...] add the given files in the next commit
271 remove [files...] remove the given files in the next commit
272 addremove add all new files, delete all missing files
273 commit commit all changes to the repository
274 history show changeset history
275 log <file> show revision history of a single file
276 dump <file> [rev] dump the latest or given revision of a file
277 dumpmanifest [rev] dump the latest or given revision of the manifest
278 """
279 sys.exit(1)
288 sys.exit(1)
General Comments 0
You need to be logged in to leave comments. Login now