1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-26 22:56:15 +01:00

- fix 'status <filename>'

- use filename matching to exclude files [#208969]
- add '.gitignore', '.pc', '*~' to ignore list
- add testcase
This commit is contained in:
Dr. Peter Poeml 2006-09-29 14:34:18 +00:00
parent 2b4a5ae46a
commit 5f8fc4e340
5 changed files with 22 additions and 15 deletions

1
NEWS
View File

@ -1,4 +1,5 @@
since 0.8:
- fix 'status' to work with project directories as arguments
- 'rebuildpac' now accepts additional repo and arch argument. Note:
the syntax has changed.
- add 'prjresults' command to display aggregated build status over

2
TODO
View File

@ -68,8 +68,6 @@ Transmitting file data ..
15:50 < DuDE> kesselborn: hm, das sollte ich aendern
17:30 < DuDE> jbl_: at the moment there is only exclude_stuff = [store, '.svn', 'CVS'], it should be extended to use globs

View File

@ -349,6 +349,8 @@ usage: osc st
pacpaths += [arg + '/' + n for n in prj.pacs_have]
elif is_package_dir(arg):
pacpaths.append(arg)
elif os.path.isfile(arg):
pacpaths.append(arg)
else:
sys.exit('osc: error: %s is neither a project or a package directory' % arg)
@ -362,6 +364,8 @@ usage: osc st
p.todo = p.filenamelist + p.filenamelist_unvers
for filename in p.todo:
if filename in p.excluded:
continue
s = p.status(filename)
if s == 'F':
print statfrmt('!', pathjoin(p.dir, filename))
@ -390,7 +394,7 @@ usage: osc add file1 file2 ...
for pac in pacs:
for filename in pac.todo:
if filename in exclude_stuff:
if filename in pac.excluded:
continue
if filename in pac.filenamelist:
print 'osc: warning: \'%s\' is already under version control' % filename
@ -413,8 +417,6 @@ usage: osc addremove
p.todo = p.filenamelist + p.filenamelist_unvers
for filename in p.todo:
if filename in exclude_stuff:
continue
if os.path.isdir(filename):
continue
state = p.status(filename)

View File

@ -22,7 +22,7 @@ scheme = 'http'
BUFSIZE = 1024*1024
store = '.osc'
exclude_stuff = [store, '.svn', 'CVS', '.git']
exclude_stuff = [store, '.svn', 'CVS', '.git', '.gitignore', '.pc', '*~']
new_project_templ = """\
@ -159,6 +159,7 @@ class Project:
class Package:
"""represent a package (its directory) and read/keep/write its metadata"""
def __init__(self, workingdir):
import fnmatch
self.dir = workingdir
self.absdir = os.path.abspath(self.dir)
self.storedir = os.path.join(self.dir, store)
@ -194,9 +195,12 @@ class Package:
self.todo_send = []
self.todo_delete = []
# gather unversioned files (the ones not listed in _meta)
# gather unversioned files, but ignore some stuff
self.excluded = [ i for i in os.listdir(self.dir)
for j in exclude_stuff
if fnmatch.fnmatch(i, j) ]
self.filenamelist_unvers = [ i for i in os.listdir(self.dir)
if i not in exclude_stuff
if i not in self.excluded
if i not in self.filenamelist ]
def addfile(self, n):
@ -507,9 +511,6 @@ def is_package_dir(d):
def findpacs(files):
pacs = []
for f in files:
if f in exclude_stuff:
break
p = filedir_to_pac(f)
known = None
for i in pacs:

View File

@ -187,11 +187,16 @@ Transmitting file data
self.assertEqual(self.err, '')
self.assertEqual(self.out, 'A %s/foo2\n? %s/onlyinwc\n' % (os.getcwd(), os.getcwd()))
# status with a relative directory as argument
reldir = os.path.basename(os.getcwd())
self.out, self.err = runosc('st ../%s' % reldir)
# status with an absolute directory as argument
self.out, self.err = runosc('st %s' % os.getcwd())
self.assertEqual(self.err, '')
self.assertEqual(self.out, 'A ../%s/foo2\n? ../%s/onlyinwc\n' % (reldir, reldir))
self.assertEqual(self.out, 'A %s/foo2\n? %s/onlyinwc\n' % (os.getcwd(), os.getcwd()))
# status with a single file as argument
reldir = os.path.basename(os.getcwd())
self.out, self.err = runosc('st foo2')
self.assertEqual(self.err, '')
self.assertEqual(self.out, 'A foo2\n')
# check in a single argument
self.out, self.err = runosc('ci foo2')