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