This duplicates the work of the source validator and is just annoying.
Suggested-by: Michal Vyskocil
Signed-off-by: Michal Marek
---
Sorry, here is the actual v2 patch that deletes more unused functions.
Michal
---
osc/commandline.py | 15 +------
osc/core.py | 120 ----------------------------------------------------
2 files changed, 1 insertions(+), 134 deletions(-)
diff --git a/osc/commandline.py b/osc/commandline.py
index 0e4673c..15fc016 100644
--- a/osc/commandline.py
+++ b/osc/commandline.py
@@ -3350,7 +3350,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('-F', '--file', metavar='FILE',
help='read log message from FILE, \'-\' denotes standard input.')
@cmdln.option('-f', '--force', default=False, action="store_true",
- help='force commit - do not tests a file list')
+ help='ignored')
@cmdln.option('--skip-validation', default=False, action="store_true",
help='Skip the source validation')
@cmdln.option('--verbose-validation', default=False, action="store_true",
@@ -3361,16 +3361,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
Upload content which is changed in your working copy, to the repository
server.
- Optionally checks the state of a working copy, if found a file with
- unknown state, it requests an user input:
- * skip - don't change anything, just move to another file
- * remove - remove a file from dir
- * edit file list - edit filelist using EDITOR
- * commit - don't check anything and commit package
- * abort - abort commit - this is default value
- This can be supressed by check_filelist config item, or -f/--force
- command line option.
-
examples:
osc ci # current dir
osc ci <dir>
@@ -3418,9 +3408,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
pacs = findpacs(args)
- if conf.config['check_filelist'] and not opts.force:
- check_filelist_before_commit(pacs)
-
if conf.config['do_package_tracking'] and len(pacs) > 0:
prj_paths = {}
single_paths = []
diff --git a/osc/core.py b/osc/core.py
index f41661e..9d86292 100644
--- a/osc/core.py
+++ b/osc/core.py
@@ -2035,99 +2035,6 @@ rev: %s
si.execute(self.absdir, mode, singleservice)
os.chdir(curdir)
- def prepare_filelist(self):
- """Prepare a list of files, which will be processed by process_filelist
- method. This allows easy modifications of a file list in commit
- phase.
- """
- if not self.todo:
- self.todo = self.filenamelist + self.filenamelist_unvers
- self.todo.sort()
-
- ret = ""
- for f in [f for f in self.todo if not os.path.isdir(f)]:
- action = 'leave'
- status = self.status(f)
- if status == 'S':
- continue
- if status == '!':
- action = 'remove'
- ret += "%s %s %s\n" % (action, status, f)
-
- ret += """
-# Edit a filelist for package \'%s\'
-# Commands:
-# l, leave = leave a file as is
-# r, remove = remove a file
-# a, add = add a file
-#
-# If you remove file from a list, it will be unchanged
-# If you remove all, commit will be aborted""" % self.name
-
- return ret
-
- def edit_filelist(self):
- """Opens a package list in editor for editing. This allows easy
- modifications of it just by simple text editing
- """
-
- import tempfile
- (fd, filename) = tempfile.mkstemp(prefix = 'osc-filelist', suffix = '.txt')
- f = os.fdopen(fd, 'w')
- f.write(self.prepare_filelist())
- f.close()
- mtime_orig = os.stat(filename).st_mtime
-
- while 1:
- run_editor(filename)
- mtime = os.stat(filename).st_mtime
- if mtime_orig < mtime:
- filelist = open(filename).readlines()
- os.unlink(filename)
- break
- else:
- raise oscerr.UserAbort()
-
- return self.process_filelist(filelist)
-
- def process_filelist(self, filelist):
- """Process a filelist - it add/remove or leave files. This depends on
- user input. If no file is processed, it raises an ValueError
- """
-
- loop = False
- for line in [l.strip() for l in filelist if (l[0] != "#" or l.strip() != '')]:
-
- foo = line.split(' ')
- if len(foo) == 4:
- action, state, name = (foo[0], ' ', foo[3])
- elif len(foo) == 3:
- action, state, name = (foo[0], foo[1], foo[2])
- else:
- break
- action = action.lower()
- loop = True
-
- if action in ('r', 'remove'):
- if self.status(name) == '?':
- os.unlink(name)
- if name in self.todo:
- self.todo.remove(name)
- else:
- self.delete_file(name, True)
- elif action in ('a', 'add'):
- if self.status(name) != '?':
- print "Cannot add file %s with state %s, skipped" % (name, self.status(name))
- else:
- self.addfile(name)
- elif action in ('l', 'leave'):
- pass
- else:
- raise ValueError("Unknow action `%s'" % action)
-
- if not loop:
- raise ValueError("Empty filelist")
-
def revert(self, filename):
if not filename in self.filenamelist and not filename in self.to_be_added:
raise oscerr.OscIOError(None, 'file \'%s\' is not under version control' % filename)
@@ -5903,33 +5810,6 @@ def get_commit_msg(wc_dir, pacs):
store_unlink_file(wc_dir, '_commit_msg')
return msg
-def check_filelist_before_commit(pacs):
-
- # warn if any of files has a ? status (usually a patch, or new source was not added to meta)
- for p in pacs:
- # no files given as argument? Take all files in current dir
- if not p.todo:
- p.todo = p.filenamelist + p.filenamelist_unvers
- p.todo.sort()
- for f in [f for f in p.todo if not os.path.isdir(f)]:
- if not f.startswith('_service:') and not f.startswith('_service_') and p.status(f) in ('?', '!'):
- print 'File "%s" found, but not listed in package meta.' % f
- resp = raw_input('(s)kip/(r)emove/(e)dit file lists/(c)ommit/(A)bort? ')
- if resp in ('s', 'S'):
- continue
- elif resp in ('r', 'R', 'd', 'D'):
- p.process_filelist(['r ? %s' % f])
- elif resp in ('e', 'E'):
- try:
- p.edit_filelist()
- except ValueError:
- print >>sys.stderr, "Error during processiong of file list."
- raise oscerr.UserAbort()
- elif resp in ('c', 'C'):
- break
- else:
- raise oscerr.UserAbort()
-
def print_request_list(apiurl, project, package = None, states = ('new','review',), force = False):
"""
prints list of pending requests for the specified project/package if "check_for_request_on_action"
--
1.7.4.1
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-buildservice+help@opensuse.org