<commit_before>import * as React from 'react'
import { Button } from '../lib/button'
import { ButtonGroup } from '../lib/button-group'
import { Dialog, DialogContent, DialogFooter } from '../dialog'
import { Dispatcher } from '../../lib/dispatcher'
import { RepositorySectionTab, PopupType } from '../../lib/app-state'
import { Repository } from '../../models/repository'
import { abortMerge } from '../../lib/git'
import { Octicon, OcticonSymbol } from '../octicons'

interface IAbortMergeWarningProps {
  readonly dispatcher: Dispatcher
  readonly repository: Repository
  readonly onDismissed: () => void
}

const titleString = __DARWIN__ ? 'Confirm Abort Merge' : 'Confirm abort merge'
const cancelButtonString = 'Cancel'
const abortButtonString = __DARWIN__ ? 'Abort Merge' : 'Abort merge'

/**
 * Modal to tell the user their merge encountered conflicts
 */
export class AbortMergeWarning extends React.Component<
  IAbortMergeWarningProps,
  {}
> {
  /**
   *  aborte the merge and dismisses the modal
   */
  private onSubmit = async () => {
    await abortMerge(this.props.repository)
    this.props.onDismissed()
    this.props.dispatcher.changeRepositorySection(
      this.props.repository,
      RepositorySectionTab.Changes
    )
  }

  /**
   *  dismisses the modal and shows the merge conflicts modal
   */
  private onCancel = () => {
    this.props.onDismissed()
    this.props.dispatcher.showPopup({
      type: PopupType.MergeConflicts,
      repository: this.props.repository,
    })
  }

  public render() {
    return (
      <Dialog
        id="abort-merge-warning"
        title={titleString}
        onDismissed={this.onCancel}
        onSubmit={this.onSubmit}
      >
        <DialogContent className="content-wrapper">
          <Octicon symbol={OcticonSymbol.alert} />
          <div className="column-left">
            <p>Are you sure you want to abort merging?</p>
            <p>
              Aborting this merge will take you back to the pre-merge state and
              the conflicts you've already resolved will still be present.
            </p>
          </div>
        </DialogContent>
        <DialogFooter>
          <ButtonGroup>
            <Button type="submit">{abortButtonString}</Button>
            <Button onClick={this.onCancel}>{cancelButtonString}</Button>
          </ButtonGroup>
        </DialogFooter>
      </Dialog>
    )<commit_msg>abort merge warning not dismissable<commit_after>import * as React from 'react'
import { Button } from '../lib/button'
import { ButtonGroup } from '../lib/button-group'
import { Dialog, DialogContent, DialogFooter } from '../dialog'
import { Dispatcher } from '../../lib/dispatcher'
import { RepositorySectionTab, PopupType } from '../../lib/app-state'
import { Repository } from '../../models/repository'
import { abortMerge } from '../../lib/git'
import { Octicon, OcticonSymbol } from '../octicons'

interface IAbortMergeWarningProps {
  readonly dispatcher: Dispatcher
  readonly repository: Repository
  readonly onDismissed: () => void
}

const titleString = __DARWIN__ ? 'Confirm Abort Merge' : 'Confirm abort merge'
const cancelButtonString = 'Cancel'
const abortButtonString = __DARWIN__ ? 'Abort Merge' : 'Abort merge'

/**
 * Modal to tell the user their merge encountered conflicts
 */
export class AbortMergeWarning extends React.Component<
  IAbortMergeWarningProps,
  {}
> {
  /**
   *  aborte the merge and dismisses the modal
   */
  private onSubmit = async () => {
    await abortMerge(this.props.repository)
    this.props.onDismissed()
    this.props.dispatcher.changeRepositorySection(
      this.props.repository,
      RepositorySectionTab.Changes
    )
  }

  /**
   *  dismisses the modal and shows the merge conflicts modal
   */
  private onCancel = () => {
    this.props.onDismissed()
    this.props.dispatcher.showPopup({
      type: PopupType.MergeConflicts,
      repository: this.props.repository,
    })
  }

  public render() {
    return (
      <Dialog
        id="abort-merge-warning"
        title={titleString}
        dismissable={false}
        onDismissed={this.onCancel}
        onSubmit={this.onSubmit}
      >
        <DialogContent className="content-wrapper">
          <Octicon symbol={OcticonSymbol.alert} />
          <div className="column-left">
            <p>Are you sure you want to abort merging?</p>
            <p>
              Aborting this merge will take you back to the pre-merge state and
              the conflicts you've already resolved will still be present.
            </p>
          </div>
        </DialogContent>
        <DialogFooter>
          <ButtonGroup>
            <Button type="submit">{abortButtonString}</Button>
            <Button onClick={this.onCancel}>{cancelButtonString}</Button>
          </ButtonGroup>
        </DialogFooter>
      </Dialog>
    )
{'fraction_non_alphanumeric': 0.11724565756823821, 'fraction_numerical': 0.0, 'mean_word_length': 2.709355828220859, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5387080', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1352, 'n_words': 355}