Patchwork [19,of,21,RFC] store: all stores have "encode" attribute exposing path encoding function

login
register
mail settings
Submitter michaeljedgar@gmail.com
Date Sept. 11, 2014, 12:26 a.m.
Message ID <41b44791ab7feaeceaaf.1410395180@adgar-macbookpro3.roam.corp.google.com>
Download mbox | patch
Permalink /patch/5794/
State Changes Requested
Headers show

Comments

michaeljedgar@gmail.com - Sept. 11, 2014, 12:26 a.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1410322117 14400
#      Wed Sep 10 00:08:37 2014 -0400
# Node ID 41b44791ab7feaeceaaf4b1031564526d497e945
# Parent  bb822c8a38958cc78b039463efa59ac9b0556af3
store: all stores have "encode" attribute exposing path encoding function

The .hgcensored file will include paths to files relative to the repository
root, and those paths must be filesystem-independent. The fncache-based stores
already have their path encoding function stored in the "encode" field, so
this change extends this pattern to other store types.

Patch

diff -r bb822c8a3895 -r 41b44791ab7f mercurial/store.py
--- a/mercurial/store.py	Wed Sep 03 22:24:02 2014 -0400
+++ b/mercurial/store.py	Wed Sep 10 00:08:37 2014 -0400
@@ -286,6 +286,7 @@ 
 class basicstore(object):
     '''base class for local repository stores'''
     def __init__(self, path, vfstype):
+        self.encode = encodedir
         vfs = vfstype(path)
         self.path = vfs.base
         self.createmode = _calcmode(vfs)
@@ -359,6 +360,7 @@ 
 
 class encodedstore(basicstore):
     def __init__(self, path, vfstype):
+        self.encode = encodefilename
         vfs = vfstype(path + '/store')
         self.path = vfs.base
         self.createmode = _calcmode(vfs)