D4125: narrow: add '--import-rules' flag to tracked command

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Sep 4 11:36:27 EDT 2018


martinvonz requested changes to this revision.
martinvonz added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> narrowcommands.py:374-378
> +        try:
> +            filepath = os.path.join(pycompat.getcwd(), newrules)
> +            fp = open(filepath, 'rb')
> +        except IOError:
> +            raise error.Abort(_("file '%s' not found") % filepath)

Perhaps we should use `util.readfile()`.  I saw that that's what e.g. `hg commit --logfile` does. See https://www.mercurial-scm.org/repo/hg/file/2df3271ef139/mercurial/cmdutil.py#l844 and other callers for examples.

(Even if we decided to not use that helper, we should probably move `fp.read()` inside the try-block.)

> test-narrow-trackedcmd.t:79
> +
> +  $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
> +  *: update widest v4 (glob)

We should switch to {rev} here like I did for the other narrow tests in another patch

REPOSITORY
  rHG Mercurial

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

To: pulkit, durin42, #hg-reviewers, martinvonz
Cc: foozy, martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list