comparison hgext/mq.py @ 37603:678d760c71ff

export: extract function to write patch to file object (API) This is common use case of cmdutil.export(), and we wouldn't want to handle formatter thingy everywhere. .. api:: The ``fp`` argument is removed from ``cmdutil.export()``. Use ``cmdutil.exportfile()`` instead.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 12 Apr 2018 22:59:49 +0900
parents c4a0626f6b6e
children 88c2d0e639b1
comparison
equal deleted inserted replaced
37602:52670eaa14b4 37603:678d760c71ff
2180 '%d.diff' % r) 2180 '%d.diff' % r)
2181 checkseries(patchname) 2181 checkseries(patchname)
2182 self.checkpatchname(patchname, force) 2182 self.checkpatchname(patchname, force)
2183 self.fullseries.insert(0, patchname) 2183 self.fullseries.insert(0, patchname)
2184 2184
2185 patchf = self.opener(patchname, "w") 2185 with self.opener(patchname, "w") as fp:
2186 cmdutil.export(repo, [n], fp=patchf, opts=diffopts) 2186 cmdutil.exportfile(repo, [n], fp, opts=diffopts)
2187 patchf.close()
2188 2187
2189 se = statusentry(n, patchname) 2188 se = statusentry(n, patchname)
2190 self.applied.insert(0, se) 2189 self.applied.insert(0, se)
2191 2190
2192 self.added.append(patchname) 2191 self.added.append(patchname)