[Pkg-bazaar-commits] ./bzr/unstable r742: - new mkdir command

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:20:53 UTC 2009


------------------------------------------------------------
revno: 742
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Wed 2005-06-22 17:18:01 +1000
message:
  - new mkdir command
modified:
  NEWS
  bzrlib/commands.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2005-06-22 07:00:09 +0000
+++ b/NEWS	2005-06-22 07:18:01 +0000
@@ -5,6 +5,8 @@
     * Python plugins, automatically loaded from the directories on
       BZR_PLUGIN_PATH or ~/.bzr.conf/plugins by default.
 
+    * New 'bzr mkdir' command.
+
   CHANGES:
 
     * New ``bzr upgrade`` command to upgrade the format of a branch,

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-06-22 06:04:43 +0000
+++ b/bzrlib/commands.py	2005-06-22 07:18:01 +0000
@@ -363,6 +363,27 @@
         bzrlib.add.smart_add(file_list, verbose, not no_recurse)
 
 
+
+class cmd_mkdir(Command):
+    """Create a new versioned directory.
+
+    This is equivalent to creating the directory and then adding it.
+    """
+    takes_args = ['dir+']
+
+    def run(self, dir_list):
+        import os
+        import bzrlib.branch
+        
+        b = None
+        
+        for d in dir_list:
+            os.mkdir(d)
+            if not b:
+                b = bzrlib.branch.Branch(d)
+            b.add([d], verbose=True)
+
+
 class cmd_relpath(Command):
     """Show path of a file relative to root"""
     takes_args = ['filename']



More information about the Pkg-bazaar-commits mailing list