##// END OF EJS Templates
mq: use checkpatchname...
Idan Kamara -
r14423:7230aef6 default
parent child Browse files
Show More
@@ -892,14 +892,7 b' class queue(object):'
892 892 if date:
893 893 date = util.parsedate(date)
894 894 diffopts = self.diffopts({'git': opts.get('git')})
895 self.check_reserved_name(patchfn)
896 if os.path.exists(self.join(patchfn)):
897 if os.path.isdir(self.join(patchfn)):
898 raise util.Abort(_('"%s" already exists as a directory')
899 % patchfn)
900 else:
901 raise util.Abort(_('patch "%s" already exists') % patchfn)
902
895 self.checkpatchname(patchfn)
903 896 inclsubs = self.check_substate(repo)
904 897 if inclsubs:
905 898 inclsubs.append('.hgsubstate')
@@ -1747,10 +1740,6 b' class queue(object):'
1747 1740 if patchname in self.series:
1748 1741 raise util.Abort(_('patch %s is already in the series file')
1749 1742 % patchname)
1750 def checkfile(patchname):
1751 if not force and os.path.exists(self.join(patchname)):
1752 raise util.Abort(_('patch "%s" already exists')
1753 % patchname)
1754 1743
1755 1744 if rev:
1756 1745 if files:
@@ -1798,9 +1787,8 b' class queue(object):'
1798 1787
1799 1788 if not patchname:
1800 1789 patchname = normname('%d.diff' % r)
1801 self.check_reserved_name(patchname)
1802 1790 checkseries(patchname)
1803 checkfile(patchname)
1791 self.checkpatchname(patchname, force)
1804 1792 self.full_series.insert(0, patchname)
1805 1793
1806 1794 patchf = self.opener(patchname, "w")
@@ -1827,8 +1815,7 b' class queue(object):'
1827 1815 raise util.Abort(_("patch %s does not exist") % filename)
1828 1816
1829 1817 if patchname:
1830 self.check_reserved_name(patchname)
1831 checkfile(patchname)
1818 self.checkpatchname(patchname, force)
1832 1819
1833 1820 self.ui.write(_('renaming %s to %s\n')
1834 1821 % (filename, patchname))
@@ -1841,8 +1828,7 b' class queue(object):'
1841 1828 raise util.Abort(_('need --name to import a patch from -'))
1842 1829 elif not patchname:
1843 1830 patchname = normname(os.path.basename(filename.rstrip('/')))
1844 self.check_reserved_name(patchname)
1845 checkfile(patchname)
1831 self.checkpatchname(patchname, force)
1846 1832 try:
1847 1833 if filename == '-':
1848 1834 text = sys.stdin.read()
@@ -2606,12 +2592,7 b' def rename(ui, repo, patch, name=None, *'
2606 2592 if os.path.isdir(absdest):
2607 2593 name = normname(os.path.join(name, os.path.basename(patch)))
2608 2594 absdest = q.join(name)
2609 if os.path.exists(absdest):
2610 raise util.Abort(_('%s already exists') % absdest)
2611
2612 if name in q.series:
2613 raise util.Abort(
2614 _('A patch named %s already exists in the series file') % name)
2595 q.checkpatchname(name)
2615 2596
2616 2597 ui.note(_('renaming %s to %s\n') % (patch, name))
2617 2598 i = q.find_series(patch)
General Comments 0
You need to be logged in to leave comments. Login now