Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 907:652507dc9fce
Modify init command to take an optional directory to set up.
If the directory does not exist, it is created.
If no directory is given, the current directory is used.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Sun, 14 Aug 2005 21:33:09 -0800 |
parents | c711930cf15d |
children | 891b6a262c4b |
comparison
equal
deleted
inserted
replaced
906:c711930cf15d | 907:652507dc9fce |
---|---|
770 | 770 |
771 if len(files) > 0: | 771 if len(files) > 0: |
772 addremove(ui, repo, *files) | 772 addremove(ui, repo, *files) |
773 repo.commit(files, message, user) | 773 repo.commit(files, message, user) |
774 | 774 |
775 def init(ui, source=None): | 775 def init(ui, dest="."): |
776 """create a new repository in the current directory""" | 776 """create a new repository in the given directory""" |
777 | 777 if not os.path.exists(dest): |
778 if source: | 778 os.mkdir(dest) |
779 raise util.Abort("no longer supported: use \"hg clone\" instead") | 779 hg.repository(ui, dest, create=1) |
780 hg.repository(ui, ".", create=1) | |
781 | 780 |
782 def locate(ui, repo, *pats, **opts): | 781 def locate(ui, repo, *pats, **opts): |
783 """locate files matching specific patterns""" | 782 """locate files matching specific patterns""" |
784 end = '\n' | 783 end = '\n' |
785 if opts['print0']: end = '\0' | 784 if opts['print0']: end = '\0' |
1277 "import|patch": | 1276 "import|patch": |
1278 (import_, | 1277 (import_, |
1279 [('p', 'strip', 1, 'path strip'), | 1278 [('p', 'strip', 1, 'path strip'), |
1280 ('b', 'base', "", 'base path')], | 1279 ('b', 'base', "", 'base path')], |
1281 "hg import [-p NUM] [-b BASE] PATCH..."), | 1280 "hg import [-p NUM] [-b BASE] PATCH..."), |
1282 "^init": (init, [], 'hg init'), | 1281 "^init": (init, [], 'hg init [DEST]'), |
1283 "locate": | 1282 "locate": |
1284 (locate, | 1283 (locate, |
1285 [('r', 'rev', '', 'revision'), | 1284 [('r', 'rev', '', 'revision'), |
1286 ('0', 'print0', None, 'end records with NUL'), | 1285 ('0', 'print0', None, 'end records with NUL'), |
1287 ('f', 'fullpath', None, 'print complete paths'), | 1286 ('f', 'fullpath', None, 'print complete paths'), |