[PATCH] automv: new experimental extension

Augie Fackler raf at durin42.com
Fri Feb 5 16:17:03 EST 2016


On Thu, Feb 04, 2016 at 07:47:41PM +0000, Martijn Pieters wrote:
> # HG changeset patch
> # User Martijn Pieters <mjpieters at fb.com>
> # Date 1454615245 0
> #      Thu Feb 04 19:47:25 2016 +0000
> # Node ID b1878a8f4543825e3f4052dc54323c2a0dbc46f1
> # Parent  c6d86560175c18e1e130e1ccebb89b7045096452
> automv: new experimental extension
>
> Automatically detect moves and record them at commit time.
>
> This extension was originally developed at
> https://bitbucket.org/facebook/hg-experimental

Probably worth mentioning that 0.75 was chosen somewhat arbitrarily,
and that it might be worthwhile as a future endeavor to try and look
at real-world repo histories to figure out a better number?

>
> diff --git a/hgext/automv.py b/hgext/automv.py
> new file mode 100644
> --- /dev/null
> +++ b/hgext/automv.py
> @@ -0,0 +1,79 @@
> +# automv.py
> +#
> +# Copyright 2013-2016 Facebook, Inc.
> +#
> +# This software may be used and distributed according to the terms of the
> +# GNU General Public License version 2 or any later version.
> +"""Check for unrecorded moves at commit time (EXPERIMENTAL)
> +
> +This extension checks at commit/amend time if any of the committed files
> +comes from an unrecorded mv.
> +
> +The threshold at which a file is considered a move can be set with the
> +``automv.similarity`` config option; the default value is 0.75.
> +
> +"""
> +import mercurial.commands
> +import mercurial.copies
> +import mercurial.extensions
> +import mercurial.scmutil
> +import mercurial.similar

any reason not to do this as

from mercurial import (
  commands,
  copies,
  extensions,
  scmutil,
  similar,
  )

? That's the pattern we've been using most places, and I'm not at all
used to leaving the mercurial. on the module names.


[snip rest of implementation and test which looks fine]

> diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
> --- a/tests/test-check-py3-compat.t
> +++ b/tests/test-check-py3-compat.t
> @@ -33,6 +33,7 @@
>    doc/hgmanpage.py not using absolute_import
>    hgext/__init__.py not using absolute_import
>    hgext/acl.py not using absolute_import
> +  hgext/automv.py not using absolute_import

Can I convince you to conform to the absolute_import format so we are
one step closer to Python 3?

>    hgext/blackbox.py not using absolute_import
>    hgext/bugzilla.py not using absolute_import
>    hgext/censor.py not using absolute_import
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list