From 5a97588b850503826d5e7c8754a47030b9150607 Mon Sep 17 00:00:00 2001 From: Juergen Weigert Date: Mon, 8 Mar 2010 00:08:55 +0100 Subject: [PATCH] osc add now clears files from _to_be_deleted This happens, if a file was previously deleted, and the user changes his mind before a commit. Such an add is no longer an add, but a cancel for the planned delete. This resulted in unexpected loss of the file, on the server, as the message 'is already under version control' is quite misleading in this case. --- osc/core.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osc/core.py b/osc/core.py index dc447a9d..449a1f1d 100644 --- a/osc/core.py +++ b/osc/core.py @@ -4437,7 +4437,14 @@ def addFiles(filenames, prj_obj = None): print >>sys.stderr, 'osc: warning: \'%s\' is excluded from a working copy' % filename continue if filename in pac.filenamelist: - print >>sys.stderr, 'osc: warning: \'%s\' is already under version control' % filename + # check if this is a re-add after delete. + pac.to_be_deleted = read_tobedeleted(pac.dir) + try: + pac.to_be_deleted.remove(filename) + print >>sys.stderr, 'osc: Note: \'%s\' was deleted, is now re-added' % filename + pac.write_deletelist() + except: + print >>sys.stderr, 'osc: Warning: \'%s\' is already under version control' % filename continue if pac.dir != '.': pathname = os.path.join(pac.dir, filename)