Patchwork [3,of,4,V2] obsolete: use version constants in the format mapping

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 30, 2014, 6:01 p.m.
Message ID <aeae860293266be3c535.1412100084@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6040/
State Accepted
Headers show

Comments

Pierre-Yves David - Sept. 30, 2014, 6:01 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1410908271 25200
#      Tue Sep 16 15:57:51 2014 -0700
# Node ID aeae860293266be3c53587b69961d2aa55ea11c8
# Parent  b844b3a93afe695d712fd002764b8507821c46fe
obsolete: use version constants in the format mapping
Pierre-Yves David - Oct. 2, 2014, 2:03 a.m.
On 09/30/2014 01:01 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1410908271 25200
> #      Tue Sep 16 15:57:51 2014 -0700
> # Node ID aeae860293266be3c53587b69961d2aa55ea11c8
> # Parent  b844b3a93afe695d712fd002764b8507821c46fe
> obsolete: use version constants in the format mapping

patch 1-3 have been pushed to the clowncopter after real live review 
from Matt.

Patch is 4 is being reworked (as expectable for a binary format patch)

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -208,11 +208,11 @@  def _fm0encodeonemarker(marker):
     data.extend(sucs)
     return _pack(format, *data) + metadata
 
 # mapping to read/write various marker formats
 # <version> -> (decoder, encoder)
-formats = {0: (_fm0readmarkers, _fm0encodeonemarker)}
+formats = {_fm0version: (_fm0readmarkers, _fm0encodeonemarker)}
 
 def _readmarkers(data):
     """Read and enumerate markers from raw data"""
     off = 0
     diskversion = _unpack('>B', data[off:off + 1])[0]