diff -r 2b83c26b29f3 -r 1b82a26635d7 hgext/mq.py --- a/hgext/mq.py Mon Jun 28 23:23:55 2010 +0200 +++ b/hgext/mq.py Tue Jun 29 03:09:42 2010 +0530 @@ -250,6 +250,7 @@ self.ui = ui self.applied_dirty = 0 self.series_dirty = 0 + self.added = [] self.series_path = "series" self.status_path = "status" self.guards_path = "guards" @@ -1622,7 +1623,7 @@ if (len(files) > 1 or len(rev) > 1) and patchname: raise util.Abort(_('option "-n" not valid when importing multiple ' 'patches')) - added = [] + self.added = [] if rev: # If mq patches are applied, we can only import revisions # that form a linear path to qbase. @@ -1672,10 +1673,11 @@ se = statusentry(n, patchname) self.applied.insert(0, se) - added.append(patchname) + self.added.append(patchname) patchname = None self.parse_series() self.applied_dirty = 1 + self.series_dirty = True for i, filename in enumerate(files): if existing: @@ -1709,13 +1711,10 @@ index = self.full_series_end() + i self.full_series[index:index] = [patchname] self.parse_series() + self.series_dirty = True self.ui.warn(_("adding %s to series file\n") % patchname) - added.append(patchname) + self.added.append(patchname) patchname = None - self.series_dirty = 1 - qrepo = self.qrepo() - if qrepo: - qrepo[None].add(added) def delete(ui, repo, *patches, **opts): """remove patches from queue @@ -1805,10 +1804,15 @@ using the --name flag. """ q = repo.mq - q.qimport(repo, filename, patchname=opts['name'], + try: + q.qimport(repo, filename, patchname=opts['name'], existing=opts['existing'], force=opts['force'], rev=opts['rev'], git=opts['git']) - q.save_dirty() + finally: + q.save_dirty() + qrepo = q.qrepo() + if qrepo: + qrepo[None].add(q.added) if opts.get('push') and not opts.get('rev'): return q.push(repo, None)