Mercurial > hg
changeset 10480:3076b39d7f3e stable
mq: unify implementation of qinit and init -Q
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Mon, 15 Feb 2010 00:16:59 -0800 |
parents | bb508b312359 |
children | 3062af0ba177 |
files | hgext/mq.py |
diffstat | 1 files changed, 20 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Mon Nov 16 16:10:05 2009 -0500 +++ b/hgext/mq.py Mon Feb 15 00:16:59 2010 -0800 @@ -1830,19 +1830,14 @@ return q.push(repo, None) return 0 -def init(ui, repo, **opts): - """init a new queue repository (DEPRECATED) +def qinit(ui, repo, create): + """initialize a new queue repository - The queue repository is unversioned by default. If - -c/--create-repo is specified, qinit will create a separate nested - repository for patches (qinit -c may also be run later to convert - an unversioned patch repository into a versioned one). You can use - qcommit to commit changes to this queue repository. - - This command is deprecated. Without -c, it's implied by other relevant - commands. With -c, use hg init -Q instead.""" + This command also creates a series file for ordering patches, and + an mq-specific .hgignore file in the queue repository, to exclude + the status and guards files (these contain mostly transient state).""" q = repo.mq - r = q.init(repo, create=opts['create_repo']) + r = q.init(repo, create) q.save_dirty() if r: if not os.path.exists(r.wjoin('.hgignore')): @@ -1859,6 +1854,19 @@ commands.add(ui, r) return 0 +def init(ui, repo, **opts): + """init a new queue repository (DEPRECATED) + + The queue repository is unversioned by default. If + -c/--create-repo is specified, qinit will create a separate nested + repository for patches (qinit -c may also be run later to convert + an unversioned patch repository into a versioned one). You can use + qcommit to commit changes to this queue repository. + + This command is deprecated. Without -c, it's implied by other relevant + commands. With -c, use hg init -Q instead.""" + return qinit(ui, repo, create=opts['create_repo']) + def clone(ui, source, dest=None, **opts): '''clone main and patch repository at same time @@ -2630,22 +2638,7 @@ repopath = cmdutil.findrepo(os.getcwd()) repo = hg.repository(ui, repopath) - q = repo.mq - r = q.init(repo, create=True) - q.save_dirty() - - if not os.path.exists(r.wjoin('.hgignore')): - fp = r.wopener('.hgignore', 'w') - fp.write('^\\.hg\n') - fp.write('^\\.mq\n') - fp.write('syntax: glob\n') - fp.write('status\n') - fp.write('guards\n') - fp.close() - if not os.path.exists(r.wjoin('series')): - r.wopener('series', 'w').close() - r.add(['.hgignore', 'series']) - commands.add(ui, r) + return qinit(ui, repo, True) def mqcommand(orig, ui, repo, *args, **kwargs): """Add --mq option to operate on patch repository instead of main"""