mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 01:46:13 +01:00
Migrate Project.wc_repair() to Store
This commit is contained in:
parent
ba98834160
commit
74d46bf8da
@ -1,8 +1,8 @@
|
|||||||
import functools
|
import functools
|
||||||
|
|
||||||
from .. import core as osc_core
|
from .. import core as osc_core
|
||||||
|
from .. import store as osc_store
|
||||||
from . import api
|
from . import api
|
||||||
from . import store
|
|
||||||
|
|
||||||
|
|
||||||
@functools.total_ordering
|
@functools.total_ordering
|
||||||
@ -79,7 +79,7 @@ class ApiPackage(PackageBase):
|
|||||||
class LocalPackage(PackageBase):
|
class LocalPackage(PackageBase):
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
self.dir = 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)
|
super().__init__(self.store.apiurl, self.store.project, self.store.package)
|
||||||
|
|
||||||
def _get_directory_node(self):
|
def _get_directory_node(self):
|
||||||
|
@ -760,8 +760,9 @@ class Project:
|
|||||||
return dirty_files
|
return dirty_files
|
||||||
|
|
||||||
def wc_repair(self, apiurl=None):
|
def wc_repair(self, apiurl=None):
|
||||||
global store
|
store = Store(self.dir)
|
||||||
if not os.path.exists(os.path.join(self.dir, store, '_apiurl')) or apiurl:
|
store.assert_is_project()
|
||||||
|
if not store.exists("_apiurl") or apiurl:
|
||||||
if apiurl is None:
|
if apiurl is None:
|
||||||
msg = 'cannot repair wc: the \'_apiurl\' file is missing but ' \
|
msg = 'cannot repair wc: the \'_apiurl\' file is missing but ' \
|
||||||
'no \'apiurl\' was passed to wc_repair'
|
'no \'apiurl\' was passed to wc_repair'
|
||||||
@ -769,8 +770,8 @@ class Project:
|
|||||||
raise oscerr.WorkingCopyInconsistent(self.name, None, [], msg)
|
raise oscerr.WorkingCopyInconsistent(self.name, None, [], msg)
|
||||||
# sanity check
|
# sanity check
|
||||||
conf.parse_apisrv_url(None, apiurl)
|
conf.parse_apisrv_url(None, apiurl)
|
||||||
store_write_apiurl(self.dir, apiurl)
|
store.apiurl = apiurl
|
||||||
self.apiurl = store_read_apiurl(self.dir, defaulturl=False)
|
self.apiurl = apiurl
|
||||||
|
|
||||||
def checkout_missing_pacs(self, sinfos, expand_link=False, unexpand_link=False):
|
def checkout_missing_pacs(self, sinfos, expand_link=False, unexpand_link=False):
|
||||||
for pac in self.pacs_missing:
|
for pac in self.pacs_missing:
|
||||||
|
Loading…
Reference in New Issue
Block a user