<commit_before>import React, {Component, PropTypes} from 'react'
import matchPath from 'react-router/matchPath'

const computeMatch = (location, { computedMatch, path, exact, strict }) =>
computedMatch || matchPath(location.pathname, path, { exact, strict })

/**
 * The public API for matching a single path and rendering.
 */
export default class HistoryRoute extends Component {
  static contextTypes = {
    router: PropTypes.object.isRequired,
    location: PropTypes.object.isRequired
  }

  static propTypes = {
    computedMatch: PropTypes.object, // private, from <Switch>
    path: PropTypes.string,
    exact: PropTypes.bool,
    strict: PropTypes.bool,
    component: PropTypes.func,
    render: PropTypes.func,
    children: PropTypes.oneOfType([
      PropTypes.func,
      PropTypes.node
    ])
  }

  static childContextTypes = {
    router: PropTypes.object.isRequired
  }

  getChildContext() {
    return {
      router: this.router
    }
  }

  componentWillMount() {
    const parentRouter = this.context.router
    const location = this.context.location

    if (parentRouter) {
      this.router = {
        ...parentRouter,
        match: computeMatch(location, this.props)
      }

      // Start listening here so we can <Redirect> on the initial render.
      this.unlisten = parentRouter.listen(() => {
        Object.assign(this.router, parentRouter, {
          match: computeMatch(location, this.props)
        })

        this.forceUpdate()
      })
    }
  }

  componentWillReceiveProps(nextProps) {
    //console.log("CWRP", this.context)
    /*
    const location = this.context.location
    Object.assign(this.router, {
      match: computeMatch(location, nextProps)
    })
    */
  }

  componentWillUnmount() {
    this.unlisten()
  }

  render() {
    const { children, component, render } = this.props
    const props = { ...this.router }

    return (
      component ? ( // component prop gets first priority, only called if there's a match
          props.match ? React.createElement(component, props) : null
        ) : render ? ( // render prop is next, only called if there's a match
            props.match ? render(props) : null
          ) : children ? ( // children come last, always called
              typeof children === 'function' ? (
                  children(props)
                ) : !Array.isArray(children) || children.length ? ( // Preact defaults to empty children array
                    React.Children.only(children)
                  ) : (
                    null
                  )
            ) : (
              null
            )
    )
  }
}<commit_msg>Uncommented CWRP in Route, all e2e tests pass<commit_after>import React, {Component, PropTypes} from 'react'
import matchPath from 'react-router/matchPath'

const computeMatch = (location, { computedMatch, path, exact, strict }) =>
computedMatch || matchPath(location.pathname, path, { exact, strict })

/**
 * The public API for matching a single path and rendering.
 */
export default class HistoryRoute extends Component {
  static contextTypes = {
    router: PropTypes.object.isRequired,
    location: PropTypes.object.isRequired
  }

  static propTypes = {
    computedMatch: PropTypes.object, // private, from <Switch>
    path: PropTypes.string,
    exact: PropTypes.bool,
    strict: PropTypes.bool,
    component: PropTypes.func,
    render: PropTypes.func,
    children: PropTypes.oneOfType([
      PropTypes.func,
      PropTypes.node
    ])
  }

  static childContextTypes = {
    router: PropTypes.object.isRequired
  }

  getChildContext() {
    return {
      router: this.router
    }
  }

  componentWillMount() {
    const parentRouter = this.context.router
    const location = this.context.location

    if (parentRouter) {
      this.router = {
        ...parentRouter,
        match: computeMatch(location, this.props)
      }

      // Start listening here so we can <Redirect> on the initial render.
      this.unlisten = parentRouter.listen(() => {
        Object.assign(this.router, parentRouter, {
          match: computeMatch(location, this.props)
        })

        this.forceUpdate()
      })
    }
  }

  componentWillReceiveProps(nextProps) {
    const location = this.context.location
    Object.assign(this.router, {
      match: computeMatch(location, nextProps)
    })
  }

  componentWillUnmount() {
    this.unlisten()
  }

  render() {
    const { children, component, render } = this.props
    const props = { ...this.router }

    return (
      component ? ( // component prop gets first priority, only called if there's a match
          props.match ? React.createElement(component, props) : null
        ) : render ? ( // render prop is next, only called if there's a match
            props.match ? render(props) : null
          ) : children ? ( // children come last, always called
              typeof children === 'function' ? (
                  children(props)
                ) : !Array.isArray(children) || children.length ? ( // Preact defaults to empty children array
                    React.Children.only(children)
                  ) : (
                    null
                  )
            ) : (
              null
            )
    )
  }
}
{'fraction_non_alphanumeric': 0.10656990068754775, 'fraction_numerical': 0.00019098548510313216, 'mean_word_length': 2.2287299630086315, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '6597615', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1410, 'n_words': 363}