comparison hgext/mq.py @ 3083:82c9d1aac308

Make qrename handle directory targets; closes #333.
author Brendan Cully <brendan@kublai.com>
date Wed, 13 Sep 2006 08:57:08 -0700
parents bed7cb835d8d
children 240ec0e61290
comparison
equal deleted inserted replaced
3082:bed7cb835d8d 3083:82c9d1aac308
1649 1649
1650 if not name: 1650 if not name:
1651 name = patch 1651 name = patch
1652 patch = None 1652 patch = None
1653 1653
1654 if name in q.series:
1655 raise util.Abort(_('A patch named %s already exists in the series file') % name)
1656
1657 absdest = q.join(name)
1658 if os.path.exists(absdest):
1659 raise util.Abort(_('%s already exists') % absdest)
1660
1661 if patch: 1654 if patch:
1662 patch = q.lookup(patch) 1655 patch = q.lookup(patch)
1663 else: 1656 else:
1664 if not q.applied: 1657 if not q.applied:
1665 ui.write(_('No patches applied\n')) 1658 ui.write(_('No patches applied\n'))
1666 return 1659 return
1667 patch = q.lookup('qtip') 1660 patch = q.lookup('qtip')
1661 absdest = q.join(name)
1662 if os.path.isdir(absdest):
1663 name = os.path.join(name, os.path.basename(patch))
1664 absdest = q.join(name)
1665 if os.path.exists(absdest):
1666 raise util.Abort(_('%s already exists') % absdest)
1667
1668 if name in q.series:
1669 raise util.Abort(_('A patch named %s already exists in the series file') % name)
1668 1670
1669 if ui.verbose: 1671 if ui.verbose:
1670 ui.write('Renaming %s to %s\n' % (patch, name)) 1672 ui.write('Renaming %s to %s\n' % (patch, name))
1671 i = q.find_series(patch) 1673 i = q.find_series(patch)
1672 q.full_series[i] = name 1674 q.full_series[i] = name