changeset 13:ac29f67b4a45

add an option to update the packages
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 08 Nov 2010 08:18:34 -0800
parents d51923b276ef
children 8c4f353e3c7c
files buttercup/checkout.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/buttercup/checkout.py	Mon Nov 08 08:13:21 2010 -0800
+++ b/buttercup/checkout.py	Mon Nov 08 08:18:34 2010 -0800
@@ -46,6 +46,8 @@
     parser = OptionParser()
     parser.add_option('--install', action="store_true", default=False,
                       help="install the packages")
+    parser.add_option('--update', action="store_true", default=False,
+                      help="update the packages")
     parser.add_option('--list', action="store_true", default=False,
                       help="list the source to be installed")
     options, args = parser.parse_args(args)
@@ -63,10 +65,16 @@
         os.mkdir(src)
     os.chdir(src)
 
-    # clone the sources
+    # clone othe sources
     for source in sources:
         if os.path.exists(source[0]):
-            print "%d already exists"
+            if options.update:
+                os.chdir(source[0])
+                subprocess.call(['hg', 'pull'])
+                subprocess.call(['hg', 'update'])
+                os.chdir('..')
+            else:
+                print "%d already exists"
         else:
             subprocess.call(['hg', 'clone', source[1]])