Patchwork [3,of,3] merge: change modified indicator to be 20 bytes

login
register
mail settings
Submitter Durham Goode
Date Nov. 10, 2016, 11:01 a.m.
Message ID <8ac2dc68fe618be09e4e.1478775666@dev111.prn1.facebook.com>
Download mbox | patch
Permalink /patch/17434/
State Accepted
Headers show

Comments

Durham Goode - Nov. 10, 2016, 11:01 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1478773275 28800
#      Thu Nov 10 02:21:15 2016 -0800
# Node ID 8ac2dc68fe618be09e4e069a111d6149e4844763
# Parent  9b2f77c847a4dfc187b70c84caadebf41e8b248d
merge: change modified indicator to be 20 bytes

Previously we indicated that the .hgsubstate file was dirty by adding a '+' to
the end of its hash in the wctx manifest. This made is complicated to have new
manifest implementations that rely on the node length being fixed.

In previous patches we added added and modified node placeholders, so let's use
those to indicate dirty here as well. It doesn't look like anything ever
depended on this '+' (aside from it being different to the parent), so nothing
else needed to change here.
Augie Fackler - Nov. 10, 2016, 4:09 p.m.
On Thu, Nov 10, 2016 at 03:01:06AM -0800, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1478773275 28800
> #      Thu Nov 10 02:21:15 2016 -0800
> # Node ID 8ac2dc68fe618be09e4e069a111d6149e4844763
> # Parent  9b2f77c847a4dfc187b70c84caadebf41e8b248d
> merge: change modified indicator to be 20 bytes

Queued these, thanks

>
> Previously we indicated that the .hgsubstate file was dirty by adding a '+' to
> the end of its hash in the wctx manifest. This made is complicated to have new
> manifest implementations that rely on the node length being fixed.
>
> In previous patches we added added and modified node placeholders, so let's use
> those to indicate dirty here as well. It doesn't look like anything ever
> depended on this '+' (aside from it being different to the parent), so nothing
> else needed to change here.
>
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -18,6 +18,7 @@ from .node import (
>      addednodeid,
>      bin,
>      hex,
> +    modifiednodeid,
>      nullhex,
>      nullid,
>      nullrev,
> @@ -815,7 +816,7 @@ def manifestmerge(repo, wctx, p2, pa, br
>      if '.hgsubstate' in m1:
>          # check whether sub state is modified
>          if any(wctx.sub(s).dirty() for s in wctx.substate):
> -            m1['.hgsubstate'] += '+'
> +            m1['.hgsubstate'] = modifiednodeid
>
>      # Compare manifests
>      if matcher is not None:

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -18,6 +18,7 @@  from .node import (
     addednodeid,
     bin,
     hex,
+    modifiednodeid,
     nullhex,
     nullid,
     nullrev,
@@ -815,7 +816,7 @@  def manifestmerge(repo, wctx, p2, pa, br
     if '.hgsubstate' in m1:
         # check whether sub state is modified
         if any(wctx.sub(s).dirty() for s in wctx.substate):
-            m1['.hgsubstate'] += '+'
+            m1['.hgsubstate'] = modifiednodeid
 
     # Compare manifests
     if matcher is not None: