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

login
register
mail settings
Submitter Matt Harbison
Date Jan. 24, 2016, 6:25 a.m.
Message ID <85d60883b44d2092115a.1453616744@Envy>
Download mbox | patch
Permalink /patch/12880/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Matt Harbison - Jan. 24, 2016, 6:25 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@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.
Yuya Nishihara - Jan. 25, 2016, 3:23 p.m.
On Sun, 24 Jan 2016 01:25:44 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@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.

Patch

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]))