1514 default. Use -p <url> to change. |
1514 default. Use -p <url> to change. |
1515 |
1515 |
1516 The patch directory must be a nested mercurial repository, as |
1516 The patch directory must be a nested mercurial repository, as |
1517 would be created by qinit -c. |
1517 would be created by qinit -c. |
1518 ''' |
1518 ''' |
|
1519 def patchdir(repo): |
|
1520 url = repo.url() |
|
1521 if url.endswith('/'): |
|
1522 url = url[:-1] |
|
1523 return url + '/.hg/patches' |
1519 cmdutil.setremoteconfig(ui, opts) |
1524 cmdutil.setremoteconfig(ui, opts) |
1520 if dest is None: |
1525 if dest is None: |
1521 dest = hg.defaultdest(source) |
1526 dest = hg.defaultdest(source) |
1522 sr = hg.repository(ui, ui.expandpath(source)) |
1527 sr = hg.repository(ui, ui.expandpath(source)) |
1523 patchdir = opts['patches'] or (sr.url() + '/.hg/patches') |
1528 patchespath = opts['patches'] or patchdir(sr) |
1524 try: |
1529 try: |
1525 pr = hg.repository(ui, patchdir) |
1530 pr = hg.repository(ui, patchespath) |
1526 except hg.RepoError: |
1531 except hg.RepoError: |
1527 raise util.Abort(_('versioned patch repository not found' |
1532 raise util.Abort(_('versioned patch repository not found' |
1528 ' (see qinit -c)')) |
1533 ' (see qinit -c)')) |
1529 qbase, destrev = None, None |
1534 qbase, destrev = None, None |
1530 if sr.local(): |
1535 if sr.local(): |
1541 pull=opts['pull'], |
1546 pull=opts['pull'], |
1542 rev=destrev, |
1547 rev=destrev, |
1543 update=False, |
1548 update=False, |
1544 stream=opts['uncompressed']) |
1549 stream=opts['uncompressed']) |
1545 ui.note(_('cloning patch repo\n')) |
1550 ui.note(_('cloning patch repo\n')) |
1546 spr, dpr = hg.clone(ui, opts['patches'] or (sr.url() + '/.hg/patches'), |
1551 spr, dpr = hg.clone(ui, opts['patches'] or patchdir(sr), patchdir(dr), |
1547 dr.url() + '/.hg/patches', |
1552 pull=opts['pull'], update=not opts['noupdate'], |
1548 pull=opts['pull'], |
|
1549 update=not opts['noupdate'], |
|
1550 stream=opts['uncompressed']) |
1553 stream=opts['uncompressed']) |
1551 if dr.local(): |
1554 if dr.local(): |
1552 if qbase: |
1555 if qbase: |
1553 ui.note(_('stripping applied patches from destination repo\n')) |
1556 ui.note(_('stripping applied patches from destination repo\n')) |
1554 dr.mq.strip(dr, qbase, update=False, backup=None) |
1557 dr.mq.strip(dr, qbase, update=False, backup=None) |