[PATCH 1 of 3 STABLE] commit: factor the post commit status check into a cmdutil method

Yuya Nishihara yuya at tcha.org
Mon Jan 25 09:23:18 CST 2016


On Sun, 24 Jan 2016 01:25:44 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1453609470 18000
> #      Sat Jan 23 23:24:30 2016 -0500
> # Branch stable
> # Node ID 85d60883b44d2092115a54a747f9ca26ccb76b42
> # Parent  d07901a07264cc495565bce44eccb7d80afb7a25
> commit: factor the post commit status check into a cmdutil method
> 
> The largefiles extension needs to set lfstatus for this status call.  Otherwise,
> if a missing largefile is explicitly named, a confusing message is issued that
> says the largefile wasn't found, followed by another that says nothing changed.
> 
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -2841,6 +2841,9 @@
>      elif repo.ui.verbose:
>          repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
>  
> +def postcommitstatus(repo, pats, opts):
> +    return repo.status(match=scmutil.match(repo[None], pats, opts))
> +
>  def revert(ui, repo, ctx, parents, *pats, **opts):
>      parent, p2 = parents
>      node = ctx.node()
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -1720,7 +1720,7 @@
>          node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
>  
>          if not node:
> -            stat = repo.status(match=scmutil.match(repo[None], pats, opts))
> +            stat = cmdutil.postcommitstatus(repo, pats, opts)
>              if stat[3]:
>                  ui.status(_("nothing changed (%d missing files, see "
>                              "'hg status')\n") % len(stat[3]))

Perhaps it could be moved to cmdutil.commitstatus(), but that would be out of
the scope of stable changes. So I think the PATCH 1 and 2 are fine for now.


More information about the Mercurial-devel mailing list