##// END OF EJS Templates
mq: wrap qimport phase movement in a transaction...
Pierre-Yves David -
r22049:86c5318b default
parent child Browse files
Show More
@@ -1975,41 +1975,49 b' class queue(object):'
1975 lastparent = None
1975 lastparent = None
1976
1976
1977 diffopts = self.diffopts({'git': git})
1977 diffopts = self.diffopts({'git': git})
1978 for r in rev:
1978 tr = repo.transaction('qimport')
1979 if not repo[r].mutable():
1979 try:
1980 raise util.Abort(_('revision %d is not mutable') % r,
1980 for r in rev:
1981 hint=_('see "hg help phases" for details'))
1981 if not repo[r].mutable():
1982 p1, p2 = repo.changelog.parentrevs(r)
1982 raise util.Abort(_('revision %d is not mutable') % r,
1983 n = repo.changelog.node(r)
1983 hint=_('see "hg help phases" '
1984 if p2 != nullrev:
1984 'for details'))
1985 raise util.Abort(_('cannot import merge revision %d') % r)
1985 p1, p2 = repo.changelog.parentrevs(r)
1986 if lastparent and lastparent != r:
1986 n = repo.changelog.node(r)
1987 raise util.Abort(_('revision %d is not the parent of %d')
1987 if p2 != nullrev:
1988 % (r, lastparent))
1988 raise util.Abort(_('cannot import merge revision %d')
1989 lastparent = p1
1989 % r)
1990
1990 if lastparent and lastparent != r:
1991 if not patchname:
1991 raise util.Abort(_('revision %d is not the parent of '
1992 patchname = normname('%d.diff' % r)
1992 '%d')
1993 checkseries(patchname)
1993 % (r, lastparent))
1994 self.checkpatchname(patchname, force)
1994 lastparent = p1
1995 self.fullseries.insert(0, patchname)
1995
1996
1996 if not patchname:
1997 patchf = self.opener(patchname, "w")
1997 patchname = normname('%d.diff' % r)
1998 cmdutil.export(repo, [n], fp=patchf, opts=diffopts)
1998 checkseries(patchname)
1999 patchf.close()
1999 self.checkpatchname(patchname, force)
2000
2000 self.fullseries.insert(0, patchname)
2001 se = statusentry(n, patchname)
2001
2002 self.applied.insert(0, se)
2002 patchf = self.opener(patchname, "w")
2003
2003 cmdutil.export(repo, [n], fp=patchf, opts=diffopts)
2004 self.added.append(patchname)
2004 patchf.close()
2005 imported.append(patchname)
2005
2006 patchname = None
2006 se = statusentry(n, patchname)
2007 if rev and repo.ui.configbool('mq', 'secret', False):
2007 self.applied.insert(0, se)
2008 # if we added anything with --rev, move the secret root
2008
2009 phases.retractboundary(repo, phases.secret, [n])
2009 self.added.append(patchname)
2010 self.parseseries()
2010 imported.append(patchname)
2011 self.applieddirty = True
2011 patchname = None
2012 self.seriesdirty = True
2012 if rev and repo.ui.configbool('mq', 'secret', False):
2013 # if we added anything with --rev, move the secret root
2014 phases.retractboundary(repo, phases.secret, [n])
2015 self.parseseries()
2016 self.applieddirty = True
2017 self.seriesdirty = True
2018 tr.close()
2019 finally:
2020 tr.release()
2013
2021
2014 for i, filename in enumerate(files):
2022 for i, filename in enumerate(files):
2015 if existing:
2023 if existing:
General Comments 0
You need to be logged in to leave comments. Login now