[mirrorbrain-commits] [opensuse-svn] r6991 - trunk/tools/download-redirector-v2/mirrordoctor

From: Novell Forge SVN <noreply_at_novell.com>
Date: Fri, 3 Apr 2009 08:09:00 -0600 (MDT)
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)
_at_@ -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)
_at_@ -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.org
Received on Fri Apr 03 2009 - 14:10:10 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT