Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 2711:ca97be5babf8
mq: do not allow to qnew a patch twice
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Thu, 27 Jul 2006 16:08:56 -0700 |
parents | f8bcaf5696d5 |
children | 8e5cd8d11b51 |
line wrap: on
line diff
--- a/hgext/mq.py Thu Jul 27 15:53:08 2006 -0700 +++ b/hgext/mq.py Thu Jul 27 16:08:56 2006 -0700 @@ -409,6 +409,8 @@ self.ui.write("Local changes found, refresh first\n") sys.exit(1) def new(self, repo, patch, msg=None, force=None): + if os.path.exists(os.path.join(self.path, patch)): + raise util.Abort(_('patch "%s" already exists') % patch) commitfiles = [] (c, a, r, d, u) = repo.changes(None, None) if c or a or d or r: @@ -1137,13 +1139,12 @@ if not patch: patch = os.path.split(filename)[1] if not force and os.path.isfile(os.path.join(self.path, patch)): - self.ui.warn("patch %s already exists\n" % patch) - sys.exit(1) + raise util.Abort(_('patch "%s" already exists') % patch) patchf = self.opener(patch, "w") patchf.write(text) if patch in self.series: - self.ui.warn("patch %s is already in the series file\n" % patch) - sys.exit(1) + raise util.Abort(_('patch %s is already in the series file') + % patch) index = self.full_series_end() + i self.full_series[index:index] = [patch] self.read_series(self.full_series)