comparison hgext/mq.py @ 10692:2a6c34b14ace

Merge with stable
author Martin Geisler <mg@lazybytes.net>
date Sun, 14 Mar 2010 22:21:48 +0100
parents d4d3a8a65248 a778a367c20b
children 2c2b2d384a47
comparison
equal deleted inserted replaced
10688:d4d3a8a65248 10692:2a6c34b14ace
14 Known patches are represented as patch files in the .hg/patches 14 Known patches are represented as patch files in the .hg/patches
15 directory. Applied patches are both patch files and changesets. 15 directory. Applied patches are both patch files and changesets.
16 16
17 Common tasks (use "hg help command" for more details):: 17 Common tasks (use "hg help command" for more details)::
18 18
19 prepare repository to work with patches qinit
20 create new patch qnew 19 create new patch qnew
21 import existing patch qimport 20 import existing patch qimport
22 21
23 print patch series qseries 22 print patch series qseries
24 print applied patches qapplied 23 print applied patches qapplied
1848 1847
1849 Source patch repository is looked for in <src>/.hg/patches by 1848 Source patch repository is looked for in <src>/.hg/patches by
1850 default. Use -p <url> to change. 1849 default. Use -p <url> to change.
1851 1850
1852 The patch directory must be a nested Mercurial repository, as 1851 The patch directory must be a nested Mercurial repository, as
1853 would be created by qinit -c. 1852 would be created by init --mq.
1854 ''' 1853 '''
1855 def patchdir(repo): 1854 def patchdir(repo):
1856 url = repo.url() 1855 url = repo.url()
1857 if url.endswith('/'): 1856 if url.endswith('/'):
1858 url = url[:-1] 1857 url = url[:-1]
1866 patchespath = patchdir(sr) 1865 patchespath = patchdir(sr)
1867 try: 1866 try:
1868 hg.repository(ui, patchespath) 1867 hg.repository(ui, patchespath)
1869 except error.RepoError: 1868 except error.RepoError:
1870 raise util.Abort(_('versioned patch repository not found' 1869 raise util.Abort(_('versioned patch repository not found'
1871 ' (see qinit -c)')) 1870 ' (see init --mq)'))
1872 qbase, destrev = None, None 1871 qbase, destrev = None, None
1873 if sr.local(): 1872 if sr.local():
1874 if sr.mq.applied: 1873 if sr.mq.applied:
1875 qbase = sr.mq.applied[0].node 1874 qbase = sr.mq.applied[0].node
1876 if not hg.islocal(dest): 1875 if not hg.islocal(dest):
2602 mq = kwargs.pop('mq', None) 2601 mq = kwargs.pop('mq', None)
2603 2602
2604 if not mq: 2603 if not mq:
2605 return orig(ui, *args, **kwargs) 2604 return orig(ui, *args, **kwargs)
2606 2605
2607 repopath = cmdutil.findrepo(os.getcwd()) 2606 if args:
2607 repopath = args[0]
2608 if not hg.islocal(repopath):
2609 raise util.Abort(_('only a local queue repository '
2610 'may be initialized'))
2611 else:
2612 repopath = cmdutil.findrepo(os.getcwd())
2613 if not repopath:
2614 raise util.Abort(_('There is no Mercurial repository here '
2615 '(.hg not found)'))
2608 repo = hg.repository(ui, repopath) 2616 repo = hg.repository(ui, repopath)
2609 return qinit(ui, repo, True) 2617 return qinit(ui, repo, True)
2610 2618
2611 def mqcommand(orig, ui, repo, *args, **kwargs): 2619 def mqcommand(orig, ui, repo, *args, **kwargs):
2612 """Add --mq option to operate on patch repository instead of main""" 2620 """Add --mq option to operate on patch repository instead of main"""