diff --git a/NEWS b/NEWS index 1ef5881c..0071cfe8 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/TODO b/TODO index dd1d15b7..3cd58acc 100644 --- a/TODO +++ b/TODO @@ -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 - diff --git a/osc/commandline.py b/osc/commandline.py index 71dcd7ff..849087fa 100755 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -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) diff --git a/osc/core.py b/osc/core.py index c4df36aa..d7e5dfea 100755 --- a/osc/core.py +++ b/osc/core.py @@ -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: diff --git a/tests.py b/tests.py index 6527f2e3..df476ebd 100755 --- a/tests.py +++ b/tests.py @@ -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')