[PATCH 1 of 5] histedit: factor most commit creation in a function

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Jan 16 13:25:20 CST 2013


On 16 Jan 2013, at 12:28 PM, pierre-yves.david at logilab.fr wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1358359866 -3600
> # Node ID 92817b424cf7c73a23babf4c2f9d876b6c892cba
> # Parent  e3f5cef11d6a8eafdbaefa9b6c3d0e91fc3273fc
> histedit: factor most commit creation in a function
> 
> Later commits add two important items to histedit:
> - Obsolescence cycle prevention
> - Proper phase conservation
> 
> Those logics must be applied to all simple operations (pick, edit, mess) and
> will require verbose code.
> 
> So we introduce a new function that will provide an entry point for this new.
> logic.
> 
> The function build a closure to have a clear distinction between commit
> arguments and data provided to the function to fulfil its logic.
> 
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -174,10 +174,26 @@ editcomment = _("""# Edit history betwee
> #  d, drop = remove commit from history
> #  m, mess = edit message without changing commit content
> #
> """)
> 
> +def commitfuncfor(repo, src):
> +    """Build a commit function for the replacement of <src>
> +
> +    This function ensure we apply the same treatement to all changesets.
> +
> +    No such treatment is done yet.
> +
> +    Note that fold have its own separated logic because its handling is a bit
> +    different and non factorisable.
> +    """
> +    def commitfunc(**kwargs):
> +        return repo.commit(**kwargs)
> +    return commitfunc

Huh? Where did 'src' go?

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list