##// END OF EJS Templates
Make qrename handle directory targets; closes #333.
Brendan Cully -
r3083:82c9d1aa default
parent child Browse files
Show More
@@ -0,0 +1,25 b''
1 #!/bin/sh
2
3 echo "[extensions]" >> $HGRCPATH
4 echo "mq=" >> $HGRCPATH
5
6 hg init a
7 cd a
8
9 echo 'base' > base
10 hg ci -Ambase -d '1 0'
11
12 hg qnew -mmqbase mqbase
13 hg qrename mqbase renamed
14 mkdir .hg/patches/foo
15 hg qrename renamed foo
16 hg qseries
17 ls .hg/patches/foo
18 mkdir .hg/patches/bar
19 hg qrename foo/renamed bar
20 hg qseries
21 ls .hg/patches/bar
22 hg qrename bar/renamed baz
23 hg qseries
24 ls .hg/patches/baz
25
@@ -0,0 +1,7 b''
1 adding base
2 foo/renamed
3 renamed
4 bar/renamed
5 renamed
6 baz
7 .hg/patches/baz
@@ -1651,13 +1651,6 b' def rename(ui, repo, patch, name=None, *'
1651 1651 name = patch
1652 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 1654 if patch:
1662 1655 patch = q.lookup(patch)
1663 1656 else:
@@ -1665,6 +1658,15 b' def rename(ui, repo, patch, name=None, *'
1665 1658 ui.write(_('No patches applied\n'))
1666 1659 return
1667 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 1671 if ui.verbose:
1670 1672 ui.write('Renaming %s to %s\n' % (patch, name))
General Comments 0
You need to be logged in to leave comments. Login now