1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

Migrate Project.wc_repair() to Store

This commit is contained in:
Daniel Mach 2022-10-14 08:58:35 +02:00
parent ba98834160
commit 74d46bf8da
2 changed files with 7 additions and 6 deletions

View File

@ -1,8 +1,8 @@
import functools
from .. import core as osc_core
from .. import store as osc_store
from . import api
from . import store
@functools.total_ordering
@ -79,7 +79,7 @@ class ApiPackage(PackageBase):
class LocalPackage(PackageBase):
def __init__(self, path):
self.dir = path
self.store = store.Store(self.dir)
self.store = osc_store.Store(self.dir)
super().__init__(self.store.apiurl, self.store.project, self.store.package)
def _get_directory_node(self):

View File

@ -760,8 +760,9 @@ class Project:
return dirty_files
def wc_repair(self, apiurl=None):
global store
if not os.path.exists(os.path.join(self.dir, store, '_apiurl')) or apiurl:
store = Store(self.dir)
store.assert_is_project()
if not store.exists("_apiurl") or apiurl:
if apiurl is None:
msg = 'cannot repair wc: the \'_apiurl\' file is missing but ' \
'no \'apiurl\' was passed to wc_repair'
@ -769,8 +770,8 @@ class Project:
raise oscerr.WorkingCopyInconsistent(self.name, None, [], msg)
# sanity check
conf.parse_apisrv_url(None, apiurl)
store_write_apiurl(self.dir, apiurl)
self.apiurl = store_read_apiurl(self.dir, defaulturl=False)
store.apiurl = apiurl
self.apiurl = apiurl
def checkout_missing_pacs(self, sinfos, expand_link=False, unexpand_link=False):
for pac in self.pacs_missing: