Commits

Steve Borho  committed 56b76b0

backout: verify the working parent (fixes #1304)

  • Participants
  • Parent commits 8b7325d
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/backout.py

                            'directory is clean.'))
         self.setLayout(QVBoxLayout())
 
+        self.groups = qtlib.WidgetGroups()
+
         repo = self.repo
         try:
             bctx = repo[self.wizard().backoutrev]
             qtlib.InfoMsgBox(_('Unable to backout'),
                              _('Backout revision not found'))
             QTimer.singleShot(0, self.wizard().close)
+            return
 
         if pctx == bctx:
             lbl = _('Backing out a parent revision is a single step operation')
             self.wizard().parentbackout = True
 
         op1, op2 = repo.dirstate.parents()
+        if op1 is None:
+            qtlib.InfoMsgBox(_('Unable to backout'),
+                             _('Backout requires a parent revision'))
+            QTimer.singleShot(0, self.wizard().close)
+            return
+
         a = repo.changelog.ancestor(op1, bctx.node())
         if a != bctx.node():
             qtlib.InfoMsgBox(_('Unable to backout'),
         sep = qtlib.LabeledSeparator(_('Working directory status'))
         self.layout().addWidget(sep)
 
-        self.groups = qtlib.WidgetGroups()
-
         wdbox = QHBoxLayout()
         self.layout().addLayout(wdbox)
         self.wd_status = qtlib.StatusLabel()