# HG changeset patch # User Chris Mason # Date 1154017662 25200 # Node ID c1123e83c8e2ae6b698d8c5a502eef94fbb41bbc # Parent 6c540dd14c384fb4ab47d0a9eb23eb4a969dff3c mq: fix qnew and qimport to deal with series file comments qnew and qimport did not take comments into account when deciding where to place new patches in the series file. diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -418,7 +418,7 @@ commitfiles = c + a + r self.check_toppatch(repo) wlock = repo.wlock() - insert = self.series_end() + insert = self.full_series_end() if msg: n = repo.commit(commitfiles, "[mq]: %s" % msg, force=True, wlock=wlock) @@ -1045,6 +1045,15 @@ self.applied.append(revlog.hex(n) + ":" + '.hg.patches.save.line') self.applied_dirty = 1 + def full_series_end(self): + if len(self.applied) > 0: + (top, p) = self.applied[-1].split(':') + end = self.find_series(p) + if end == None: + return len(self.full_series) + return end + 1 + return 0 + def series_end(self): end = 0 if len(self.applied) > 0: @@ -1132,7 +1141,7 @@ if patch in self.series: self.ui.warn("patch %s is already in the series file\n" % patch) sys.exit(1) - index = self.series_end() + i + index = self.full_series_end() + i self.full_series[index:index] = [patch] self.read_series(self.full_series) self.ui.warn("adding %s to series file\n" % patch)