D626: merge: move cwd-missing detection to helper functions

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Sep 11 19:40:11 EDT 2017


martinvonz added a comment.


  Oops, I just found some old unsubmitted comments here. Sorry

INLINE COMMENTS

> merge.py:1749-1751
> +        if err.errno != errno.ENOENT:
> +            raise
> +        return None

Now that we this is a function and "return" can be used to prevent execution of lines after it, maybe not negating the condition helps a little:

  if err.errno == errno.ENOENT:
      return None
  raise

> merge.py:1756
> +    # let's check if it is present after we removed them
> +    if oldcwd and not _getcwd():
> +        # Print a warning if cwd was deleted

I think it would be clearer to move at least the "if oldcwd" back to the caller. I think the entire function seems simple enough to be in the caller now _getcwd() has been extracted, actually.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D626

To: phillco, #hg-reviewers, quark, pulkit
Cc: martinvonz, quark, mercurial-devel


More information about the Mercurial-devel mailing list