Patchwork mergestate: fix BC breakage introduced because of removal of a merge record

login
register
mail settings
Submitter Pulkit Goyal
Date Aug. 1, 2020, 1:09 p.m.
Message ID <7fc3c5fbc65f6fe85d70.1596287375@workspace>
Download mbox | patch
Permalink /patch/46956/
State Accepted
Headers show

Comments

Pulkit Goyal - Aug. 1, 2020, 1:09 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1596287368 -19800
#      Sat Aug 01 18:39:28 2020 +0530
# Branch stable
# Node ID 7fc3c5fbc65f6fe85d70ea63923b8767dda4f2e0
# Parent  9b5723784aac9013471ca273ebdfa401e8bb443e
mergestate: fix BC breakage introduced because of removal of a merge record

In fcd0cff3400a I removed the usage of RECORD_RESOLVED_OTHER. However I also
removed the reading support, hence if there is any user who runs into merge
conflict with older version of hg, upgrades hg and then tries to read
mergestate, they will end up with an MergeRecordUnsupportedError.
Pulkit Goyal - Aug. 1, 2020, 1:10 p.m.
On Sat, Aug 1, 2020 at 6:39 PM Pulkit Goyal <7895pulkit@gmail.com> wrote:
>
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1596287368 -19800
> #      Sat Aug 01 18:39:28 2020 +0530
> # Branch stable
> # Node ID 7fc3c5fbc65f6fe85d70ea63923b8767dda4f2e0
> # Parent  9b5723784aac9013471ca273ebdfa401e8bb443e
> mergestate: fix BC breakage introduced because of removal of a merge record
>
> In fcd0cff3400a I removed the usage of RECORD_RESOLVED_OTHER. However I also
> removed the reading support, hence if there is any user who runs into merge
> conflict with older version of hg, upgrades hg and then tries to read
> mergestate, they will end up with an MergeRecordUnsupportedError.

I missed the `--flag stable`. This is meant for stable branch.
Augie Fackler - Aug. 3, 2020, 5:37 p.m.
queued for stable, thanks

> On Aug 1, 2020, at 09:09, Pulkit Goyal <7895pulkit@gmail.com> wrote:
> 
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1596287368 -19800
> #      Sat Aug 01 18:39:28 2020 +0530
> # Branch stable
> # Node ID 7fc3c5fbc65f6fe85d70ea63923b8767dda4f2e0
> # Parent  9b5723784aac9013471ca273ebdfa401e8bb443e
> mergestate: fix BC breakage introduced because of removal of a merge record
> 
> In fcd0cff3400a I removed the usage of RECORD_RESOLVED_OTHER. However I also
> removed the reading support, hence if there is any user who runs into merge
> conflict with older version of hg, upgrades hg and then tries to read
> mergestate, they will end up with an MergeRecordUnsupportedError.
> 
> diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
> --- a/mercurial/mergestate.py
> +++ b/mercurial/mergestate.py
> @@ -96,6 +96,12 @@ MERGE_DRIVER_STATE_UNMARKED = b'u'
> MERGE_DRIVER_STATE_MARKED = b'm'
> MERGE_DRIVER_STATE_SUCCESS = b's'
> 
> +#####
> +# legacy records which are no longer used but kept to prevent breaking BC
> +#####
> +# This record was release in 5.4 and usage was removed in 5.5
> +LEGACY_RECORD_RESOLVED_OTHER = b'R'
> +
> 
> ACTION_FORGET = b'f'
> ACTION_REMOVE = b'r'
> @@ -249,6 +255,7 @@ class mergestate(object):
>                 RECORD_CHANGEDELETE_CONFLICT,
>                 RECORD_PATH_CONFLICT,
>                 RECORD_MERGE_DRIVER_MERGE,
> +                LEGACY_RECORD_RESOLVED_OTHER,
>             ):
>                 bits = record.split(b'\0')
>                 self._state[bits[0]] = bits[1:]
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -96,6 +96,12 @@  MERGE_DRIVER_STATE_UNMARKED = b'u'
 MERGE_DRIVER_STATE_MARKED = b'm'
 MERGE_DRIVER_STATE_SUCCESS = b's'
 
+#####
+# legacy records which are no longer used but kept to prevent breaking BC
+#####
+# This record was release in 5.4 and usage was removed in 5.5
+LEGACY_RECORD_RESOLVED_OTHER = b'R'
+
 
 ACTION_FORGET = b'f'
 ACTION_REMOVE = b'r'
@@ -249,6 +255,7 @@  class mergestate(object):
                 RECORD_CHANGEDELETE_CONFLICT,
                 RECORD_PATH_CONFLICT,
                 RECORD_MERGE_DRIVER_MERGE,
+                LEGACY_RECORD_RESOLVED_OTHER,
             ):
                 bits = record.split(b'\0')
                 self._state[bits[0]] = bits[1:]