##// END OF EJS Templates
mq: do not allow to qnew a patch twice
Vadim Gelfer -
r2711:ca97be5b default
parent child Browse files
Show More
@@ -0,0 +1,13 b''
1 #!/bin/sh
2
3 HGRCPATH=$HGTMP/.hgrc; export HGRCPATH
4 echo "[extensions]" >> $HGTMP/.hgrc
5 echo "mq=" >> $HGTMP/.hgrc
6
7 hg init a
8 cd a
9 hg qnew first.patch
10 hg qnew first.patch
11
12 touch ../first.patch
13 hg qimport ../first.patch
@@ -0,0 +1,1 b''
1 abort: patch "first.patch" already exists
@@ -409,6 +409,8 b' class queue:'
409 self.ui.write("Local changes found, refresh first\n")
409 self.ui.write("Local changes found, refresh first\n")
410 sys.exit(1)
410 sys.exit(1)
411 def new(self, repo, patch, msg=None, force=None):
411 def new(self, repo, patch, msg=None, force=None):
412 if os.path.exists(os.path.join(self.path, patch)):
413 raise util.Abort(_('patch "%s" already exists') % patch)
412 commitfiles = []
414 commitfiles = []
413 (c, a, r, d, u) = repo.changes(None, None)
415 (c, a, r, d, u) = repo.changes(None, None)
414 if c or a or d or r:
416 if c or a or d or r:
@@ -1137,13 +1139,12 b' class queue:'
1137 if not patch:
1139 if not patch:
1138 patch = os.path.split(filename)[1]
1140 patch = os.path.split(filename)[1]
1139 if not force and os.path.isfile(os.path.join(self.path, patch)):
1141 if not force and os.path.isfile(os.path.join(self.path, patch)):
1140 self.ui.warn("patch %s already exists\n" % patch)
1142 raise util.Abort(_('patch "%s" already exists') % patch)
1141 sys.exit(1)
1142 patchf = self.opener(patch, "w")
1143 patchf = self.opener(patch, "w")
1143 patchf.write(text)
1144 patchf.write(text)
1144 if patch in self.series:
1145 if patch in self.series:
1145 self.ui.warn("patch %s is already in the series file\n" % patch)
1146 raise util.Abort(_('patch %s is already in the series file')
1146 sys.exit(1)
1147 % patch)
1147 index = self.full_series_end() + i
1148 index = self.full_series_end() + i
1148 self.full_series[index:index] = [patch]
1149 self.full_series[index:index] = [patch]
1149 self.read_series(self.full_series)
1150 self.read_series(self.full_series)
General Comments 0
You need to be logged in to leave comments. Login now