Executable flagging patch

Gustavo Niemeyer gustavo at niemeyer.net
Fri Sep 30 13:59:56 BST 2005


Hello George,

> I tried out the patch a bit.  It seemed to do the right thing
> on "bzr branch", but when I did "bzr export", the execute bit
> disappeared in the exported directory.

Thank you very much for spotting the problem. The additional
patch attached will fix the issue.

-- 
Gustavo Niemeyer
http://niemeyer.net
-------------- next part --------------
diff -u bzrlib/tree.py bzrlib/tree.py
--- bzrlib/tree.py
+++ bzrlib/tree.py
@@ -263,6 +263,8 @@
             os.mkdir(fullpath)
         elif kind == 'file':
             pumpfile(tree.get_file(ie.file_id), file(fullpath, 'wb'))
+            if tree.is_executable(ie.file_id):
+                os.chmod(fullpath, 0755)
         else:
             raise BzrError("don't know how to export {%s} of kind %r" % (ie.file_id, kind))
         mutter("  export {%s} kind %s to %s" % (ie.file_id, kind, fullpath))
@@ -328,7 +330,10 @@
                 item.type = tarfile.REGTYPE
                 fileobj = tree.get_file(ie.file_id)
                 item.size = _find_file_size(fileobj)
-                item.mode = 0644
+                if tree.is_executable(ie.file_id):
+                    item.mode = 0755
+                else:
+                    item.mode = 0644
             else:
                 raise BzrError("don't know how to export {%s} of kind %r" %
                         (ie.file_id, ie.kind))


More information about the bazaar mailing list