# HG changeset patch # User mpm@selenic.com # Date 1124085616 28800 # Node ID 891b6a262c4bd0ddc770d965ff5c94602c758b7e # Parent fcd34a9577e8a8e073433fec3ef1cc207ddeaa70# Parent e2e7a2462eded5a5f03ec21e5418628fe99d6209 Merge with TAH diff --git a/doc/hg.1.txt b/doc/hg.1.txt --- a/doc/hg.1.txt +++ b/doc/hg.1.txt @@ -196,8 +196,11 @@ aliases: patch -init:: - Initialize a new repository in the current directory. +init [dest]:: + Initialize a new repository in the given directory. If the given + directory does not exist, it is created. + + If no directory is given, the current directory is used. locate [options] [files]:: Print all files under Mercurial control whose names match the diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -772,12 +772,11 @@ addremove(ui, repo, *files) repo.commit(files, message, user) -def init(ui, source=None): - """create a new repository in the current directory""" - - if source: - raise util.Abort("no longer supported: use \"hg clone\" instead") - hg.repository(ui, ".", create=1) +def init(ui, dest="."): + """create a new repository in the given directory""" + if not os.path.exists(dest): + os.mkdir(dest) + hg.repository(ui, dest, create=1) def locate(ui, repo, *pats, **opts): """locate files matching specific patterns""" @@ -1279,7 +1278,7 @@ [('p', 'strip', 1, 'path strip'), ('b', 'base', "", 'base path')], "hg import [-p NUM] [-b BASE] PATCH..."), - "^init": (init, [], 'hg init'), + "^init": (init, [], 'hg init [DEST]'), "locate": (locate, [('r', 'rev', '', 'revision'), diff --git a/tests/test-help.out b/tests/test-help.out --- a/tests/test-help.out +++ b/tests/test-help.out @@ -9,7 +9,7 @@ commit commit the specified files or all outstanding changes diff diff working directory (or selected files) export dump the header and diffs for one or more changesets - init create a new repository in the current directory + init create a new repository in the given directory log show the revision history of the repository or a single file pull pull changes from the specified source push push changes to the specified destination @@ -25,7 +25,7 @@ commit commit the specified files or all outstanding changes diff diff working directory (or selected files) export dump the header and diffs for one or more changesets - init create a new repository in the current directory + init create a new repository in the given directory log show the revision history of the repository or a single file pull pull changes from the specified source push push changes to the specified destination @@ -53,7 +53,7 @@ help show help for a given command or all commands identify print information about the working copy import import an ordered set of patches - init create a new repository in the current directory + init create a new repository in the given directory locate locate files matching specific patterns log show the revision history of the repository or a single file manifest output the latest or given revision of the project manifest @@ -90,7 +90,7 @@ help show help for a given command or all commands identify print information about the working copy import import an ordered set of patches - init create a new repository in the current directory + init create a new repository in the given directory locate locate files matching specific patterns log show the revision history of the repository or a single file manifest output the latest or given revision of the project manifest @@ -189,7 +189,7 @@ commit commit the specified files or all outstanding changes diff diff working directory (or selected files) export dump the header and diffs for one or more changesets - init create a new repository in the current directory + init create a new repository in the given directory log show the revision history of the repository or a single file pull pull changes from the specified source push push changes to the specified destination @@ -210,7 +210,7 @@ commit commit the specified files or all outstanding changes diff diff working directory (or selected files) export dump the header and diffs for one or more changesets - init create a new repository in the current directory + init create a new repository in the given directory log show the revision history of the repository or a single file pull pull changes from the specified source push push changes to the specified destination diff --git a/tests/test-notfound b/tests/test-notfound diff --git a/tests/test-notfound.out b/tests/test-notfound.out