Patchwork [15,of,19] commit: use workingctx._rawstatus for subrepo-realted commit validation

login
register
mail settings
Submitter David Schleimer
Date Feb. 10, 2013, 11:30 p.m.
Message ID <d45c2924e79b417059df.1360539005@dev010.prn1.facebook.com>
Download mbox | patch
Permalink /patch/956/
State Changes Requested
Headers show

Comments

David Schleimer - Feb. 10, 2013, 11:30 p.m.
# HG changeset patch
# User David Schleimer <dschleimer@fb.com>
# Date 1360511456 28800
# Node ID d45c2924e79b417059dfc166e2364e85d4fd09a7
# Parent  730f81cd4b340348dfc5d2eb571f3b13e01c73e4
commit: use workingctx._rawstatus for subrepo-realted commit validation

This changes a little bit of the validation we do during the commit
process to use workingctx._rawstatus to check for a .hgsub that has
been modified but not matched.  This is preparatory to moving the
validation logic into workingctx with the intention of making that
logic more accessible.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1168,8 +1168,10 @@ 
                 subs, commitsubs, newstate = wctx.commitablesubstate(match,
                                                                      force)
                 if subs:
+                    rawchanges = wctx._rawstatus()
                     if (not match('.hgsub') and
-                        '.hgsub' in (wctx.modified() + wctx.added())):
+                        # 0 = modified, 1 = added
+                        '.hgsub' in (rawchanges[0] + rawchanges[1])):
                         raise util.Abort(
                             _("can't commit subrepos without .hgsub"))
                     changes[0].insert(0, '.hgsubstate')