# HG changeset patch # User mpm@selenic.com # Date 1115233277 28800 # Node ID 2fd3e1e3783f8d1a688fa78b2c8657fec839adcd # Parent ffe6a5ca1a89071e08aa29a39a83db907ece2a7a Give a friendlier message when repo isn't found diff -r ffe6a5ca1a89 -r 2fd3e1e3783f hg --- a/hg Wed May 04 10:50:21 2005 -0800 +++ b/hg Wed May 04 11:01:17 2005 -0800 @@ -18,6 +18,26 @@ import sys, os from mercurial import hg, mdiff, fancyopts +def help(): + print """\ + commands: + + init create a new repository in this directory + branch create a branch of in this directory + merge merge changes from into local repository + checkout [changeset] checkout the latest or given changeset + status show new, missing, and changed files in working dir + add [files...] add the given files in the next commit + remove [files...] remove the given files in the next commit + addremove add all new files, delete all missing files + commit commit all changes to the repository + history show changeset history + log show revision history of a single file + dump [rev] dump the latest or given revision of a file + dumpmanifest [rev] dump the latest or given revision of the manifest +""" + + options = {} opts = [('v', 'verbose', None, 'verbose'), ('d', 'debug', None, 'debug')] @@ -39,8 +59,15 @@ elif cmd == "branch" or cmd == "clone": os.system("cp -al %s/.hg .hg" % args[0]) sys.exit(0) +elif cmd == "help": + help() + sys.exit(0) else: - repo = hg.repository(ui=ui) + try: + repo = hg.repository(ui=ui) + except: + print "Unable to open repository" + sys.exit(0) if cmd == "checkout" or cmd == "co": node = repo.changelog.tip() @@ -256,24 +283,6 @@ revisions) else: - if cmd != "help": - print "unknown command\n" - - print """\ - commands: - - init create a new repository in this directory - branch create a branch of in this directory - merge merge changes from into local repository - checkout [changeset] checkout the latest or given changeset - status show new, missing, and changed files in working dir - add [files...] add the given files in the next commit - remove [files...] remove the given files in the next commit - addremove add all new files, delete all missing files - commit commit all changes to the repository - history show changeset history - log show revision history of a single file - dump [rev] dump the latest or given revision of a file - dumpmanifest [rev] dump the latest or given revision of the manifest -""" + print "unknown command\n" + help() sys.exit(1)