1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

don't parse local meta file more than once for the filelist, thus fixing 'status' slowness; fix usage of 'up' command with more than one directory as argument

This commit is contained in:
Dr. Peter Poeml 2006-04-24 12:04:20 +00:00
parent 2dfbdf3bde
commit ab258100ca
3 changed files with 15 additions and 6 deletions

View File

@ -2,7 +2,6 @@ osc -- opensuse-commander with svn like handling
>>> BUG: at the moment, 'up' overwrites files with >>> BUG: at the moment, 'up' overwrites files with
local modifications. local modifications.
>>> At the moment, 'status' is highly inefficient.
Please send patches to poeml@suse.de, or work directly on Please send patches to poeml@suse.de, or work directly on
@ -33,6 +32,7 @@ osc co Apache subversion foo # single file
# update working copy # update working copy
osc up osc up
osc up <directory>
# check in # check in
osc ci # current dir osc ci # current dir

12
osc.py
View File

@ -108,8 +108,9 @@ def main():
os.chdir(wd) os.chdir(wd)
filelist = localmeta_get_filelist()
for filename in filenames: for filename in filenames:
s = get_file_status(project, package, filename) s = get_file_status(project, package, filename, filelist=filelist)
#if not s.startswith(' '): #if not s.startswith(' '):
# print s # print s
print s print s
@ -144,8 +145,10 @@ def main():
filenames.insert(0, i) filenames.insert(0, i)
filelist = localmeta_get_filelist()
for filename in filenames: for filename in filenames:
st = get_file_status(project, package, filename) st = get_file_status(project, package, filename, filelist=filelist)
if st.startswith('?'): if st.startswith('?'):
localmeta_addfile(filename) localmeta_addfile(filename)
print 'A ', filename print 'A ', filename
@ -183,8 +186,9 @@ def main():
files_to_send = [] files_to_send = []
files_to_delete = [] files_to_delete = []
filelist = localmeta_get_filelist()
for filename in filenames: for filename in filenames:
st = get_file_status(project, package, filename) st = get_file_status(project, package, filename, filelist=filelist)
if st.startswith('A') or st.startswith('M'): if st.startswith('A') or st.startswith('M'):
files_to_send.append(filename) files_to_send.append(filename)
print 'Sending %s' % filename print 'Sending %s' % filename
@ -233,6 +237,7 @@ def main():
# if i not in filenames and i not in exclude_stuff: # if i not in filenames and i not in exclude_stuff:
# filenames.insert(0, i) # filenames.insert(0, i)
olddir = os.getcwd()
os.chdir(wd) os.chdir(wd)
os.chdir(store) os.chdir(store)
@ -256,6 +261,7 @@ def main():
f.write(''.join(show_package_meta(project, package))) f.write(''.join(show_package_meta(project, package)))
f.close() f.close()
os.chdir(olddir)

View File

@ -210,7 +210,7 @@ def dgst(file):
return s.digest() return s.digest()
def get_file_status(prj, package, filename): def get_file_status(prj, package, filename, filelist=None):
""" """
status can be: status can be:
@ -231,7 +231,10 @@ def get_file_status(prj, package, filename):
exists = False exists = False
exists_in_store = False exists_in_store = False
if filename in localmeta_get_filelist(): if not filelist:
filelist = localmeta_get_filelist()
if filename in filelist:
known_by_meta = True known_by_meta = True
if os.path.exists(filename): if os.path.exists(filename):