##// END OF EJS Templates
mq: unify implementation of qinit and init -Q
Brendan Cully -
r10480:3076b39d stable
parent child Browse files
Show More
@@ -1830,19 +1830,14 b' def qimport(ui, repo, *filename, **opts)'
1830 return q.push(repo, None)
1830 return q.push(repo, None)
1831 return 0
1831 return 0
1832
1832
1833 def init(ui, repo, **opts):
1833 def qinit(ui, repo, create):
1834 """init a new queue repository (DEPRECATED)
1834 """initialize a new queue repository
1835
1835
1836 The queue repository is unversioned by default. If
1836 This command also creates a series file for ordering patches, and
1837 -c/--create-repo is specified, qinit will create a separate nested
1837 an mq-specific .hgignore file in the queue repository, to exclude
1838 repository for patches (qinit -c may also be run later to convert
1838 the status and guards files (these contain mostly transient state)."""
1839 an unversioned patch repository into a versioned one). You can use
1840 qcommit to commit changes to this queue repository.
1841
1842 This command is deprecated. Without -c, it's implied by other relevant
1843 commands. With -c, use hg init -Q instead."""
1844 q = repo.mq
1839 q = repo.mq
1845 r = q.init(repo, create=opts['create_repo'])
1840 r = q.init(repo, create)
1846 q.save_dirty()
1841 q.save_dirty()
1847 if r:
1842 if r:
1848 if not os.path.exists(r.wjoin('.hgignore')):
1843 if not os.path.exists(r.wjoin('.hgignore')):
@@ -1859,6 +1854,19 b' def init(ui, repo, **opts):'
1859 commands.add(ui, r)
1854 commands.add(ui, r)
1860 return 0
1855 return 0
1861
1856
1857 def init(ui, repo, **opts):
1858 """init a new queue repository (DEPRECATED)
1859
1860 The queue repository is unversioned by default. If
1861 -c/--create-repo is specified, qinit will create a separate nested
1862 repository for patches (qinit -c may also be run later to convert
1863 an unversioned patch repository into a versioned one). You can use
1864 qcommit to commit changes to this queue repository.
1865
1866 This command is deprecated. Without -c, it's implied by other relevant
1867 commands. With -c, use hg init -Q instead."""
1868 return qinit(ui, repo, create=opts['create_repo'])
1869
1862 def clone(ui, source, dest=None, **opts):
1870 def clone(ui, source, dest=None, **opts):
1863 '''clone main and patch repository at same time
1871 '''clone main and patch repository at same time
1864
1872
@@ -2630,22 +2638,7 b' def mqinit(orig, ui, *args, **kwargs):'
2630
2638
2631 repopath = cmdutil.findrepo(os.getcwd())
2639 repopath = cmdutil.findrepo(os.getcwd())
2632 repo = hg.repository(ui, repopath)
2640 repo = hg.repository(ui, repopath)
2633 q = repo.mq
2641 return qinit(ui, repo, True)
2634 r = q.init(repo, create=True)
2635 q.save_dirty()
2636
2637 if not os.path.exists(r.wjoin('.hgignore')):
2638 fp = r.wopener('.hgignore', 'w')
2639 fp.write('^\\.hg\n')
2640 fp.write('^\\.mq\n')
2641 fp.write('syntax: glob\n')
2642 fp.write('status\n')
2643 fp.write('guards\n')
2644 fp.close()
2645 if not os.path.exists(r.wjoin('series')):
2646 r.wopener('series', 'w').close()
2647 r.add(['.hgignore', 'series'])
2648 commands.add(ui, r)
2649
2642
2650 def mqcommand(orig, ui, repo, *args, **kwargs):
2643 def mqcommand(orig, ui, repo, *args, **kwargs):
2651 """Add --mq option to operate on patch repository instead of main"""
2644 """Add --mq option to operate on patch repository instead of main"""
General Comments 0
You need to be logged in to leave comments. Login now