Ticket #1838: 1838.patch

File 1838.patch, 1.3 KB (added by sascha_silbe, 13 years ago)

fix migration from 0.82 data store

  • src/carquinyol/layoutmanager.py

    From: Sascha Silbe <sascha-pgp@silbe.org>
    Subject: [PATCH] fix migration from 0.82 data store (#1838)
    
    Upgrading directly from 0.82 to 0.86/0.88 didn't migrate the data store
    contents because LayoutManager._is_empty() doesn't check for 0.82 data store
    entries.
    This patch fixes _is_empty() to recognize 0.82 data store contents.
    
    Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
    
    ---
     src/carquinyol/layoutmanager.py |    8 ++++++++
     1 files changed, 8 insertions(+), 0 deletions(-)
    
    diff --git a/src/carquinyol/layoutmanager.py b/src/carquinyol/layoutmanager.py
    index 0b0b91a..8402b6d 100644
    a b class LayoutManager(object): 
    114114        return uids
    115115
    116116    def _is_empty(self):
     117        """Check if there is any existing entry.
     118
     119        All data store layout versions are handled. Will err on the safe
     120        side (i.e. return False if there might be any entry)."""
     121        if os.path.exists(os.path.join(self._root_path, 'store')):
     122            # unmigrated 0.82 data store
     123            return False
     124
    117125        for f in os.listdir(self._root_path):
    118126            if os.path.isdir(os.path.join(self._root_path, f)) and len(f) == 2:
    119127                for g in os.listdir(os.path.join(self._root_path, f)):