Author: poeml Date: 2009-04-03 08:08:55 -0600 (Fri, 03 Apr 2009) New Revision: 6991 Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py Log: mb export: - when exporting metadata for import into a VCS, handle additions and deletions Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py =================================================================== --- trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py 2009-04-03 14:02:10 UTC (rev 6990) +++ trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py 2009-04-03 14:08:55 UTC (rev 6991) @@ -967,6 +967,9 @@ if not os.path.exists(opts.target_dir): os.makedirs(opts.target_dir, 0750) os.chdir(opts.target_dir) + for i in os.listdir('.'): + if i.startswith('.'): continue + os.unlink(i) else: sys.exit('unknown format %r' % opts.format) @@ -1001,9 +1004,20 @@ open(m.identifier, 'w').write(s) if opts.format == 'vcs' and opts.commit: + import commands + lines = commands.getoutput('%s status' % opts.commit).splitlines() + print lines + for line in lines: + state, i = line.split() + if state == '!': + os.system('%s delete %s > /dev/null' % (opts.commit, i)) + elif state == '?': + os.system('%s add %s > /dev/null' % (opts.commit, i)) + os.system('%s commit -m "autocommit by mb" %s > /dev/null' \ % (opts.commit, opts.target_dir)) + if __name__ == '__main__': import sys mirrordoctor = MirrorDoctor() _______________________________________________ Opensuse-svn mailing list Opensuse-svn_at_forge.novell.com http://forge.novell.com/mailman/listinfo/opensuse-svn _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on 2009-04-03Z14:10:10
This archive was generated by hypermail 2.2.0 : 2009-07-10Z19:18:13 GMT