[PATCH] Ability to explicitly set timestamp for commit

Magnus Therning magnus at therning.org
Wed May 18 07:53:15 BST 2005


I saw patch for this on the codeville mailing list and people seemed to
think it was useful for mirroring purposes. Here's an attempt to
implement it for bazaar.

/M

*** modified file 'bzrlib/commands.py'
--- bzrlib/commands.py 
+++ bzrlib/commands.py 
@@ -791,10 +791,10 @@
     TODO: Strict commit that fails if there are unknown or deleted files.
     """
     takes_args = ['selected*']
-    takes_options = ['message', 'file', 'verbose']
+    takes_options = ['message', 'file', 'verbose', 'committimestamp']
     aliases = ['ci', 'checkin']
 
-    def run(self, message=None, file=None, verbose=True, selected_list=None):
+    def run(self, message=None, file=None, verbose=True, selected_list=None, committimestamp=None):
         from bzrlib.commit import commit
 
         ## Warning: shadows builtin file()
@@ -808,8 +808,13 @@
             import codecs
             message = codecs.open(file, 'rt', bzrlib.user_encoding).read()
 
+        ctime = None
+        if committimestamp:
+            from time import strptime, mktime
+            ctime = mktime(strptime(committimestamp, '%Y%m%d-%H%M%S'))
+
         b = Branch('.')
-        commit(b, message, verbose=verbose, specific_files=selected_list)
+        commit(b, message, verbose=verbose, specific_files=selected_list, timestamp=ctime)
 
 
 class cmd_check(Command):


-- 
Magnus Therning                    (OpenPGP: 0xAB4DFBA4)
magnus at therning.org
http://magnus.therning.org/

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

The number of the beast - vi vi vi
     -- Delexa Jones
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050518/f58af492/attachment.pgp 


More information about the bazaar mailing list