Beispiel #1
0
 def setUp(self):
     super(TestamentSetup, self).setUp()
     self.wt = self.make_branch_and_tree('.',
                                         format='dirstate-with-subtree')
     self.wt.set_root_id('TREE_ROT')
     b = self.b = self.wt.branch
     b.nick = "test branch"
     self.wt.commit(
         message='initial null commit',
         committer='test@user',
         timestamp=1129025423,  # 'Tue Oct 11 20:10:23 2005'
         timezone=0,
         rev_id='test@user-1')
     self.build_tree_contents([('hello', 'contents of hello file'),
                               ('src/', ),
                               ('src/foo.c', 'int main()\n{\n}\n')])
     self.wt.add(['hello', 'src', 'src/foo.c'],
                 ['hello-id', 'src-id', 'foo.c-id'])
     tt = TreeTransform(self.wt)
     trans_id = tt.trans_id_tree_path('hello')
     tt.set_executability(True, trans_id)
     tt.apply()
     self.wt.commit(message='add files and directories',
                    timestamp=1129025483,
                    timezone=36000,
                    rev_id='test@user-2',
                    committer='test@user')
Beispiel #2
0
 def setUp(self):
     super(TestamentSetup, self).setUp()
     self.wt = self.make_branch_and_tree('.', format='development-subtree')
     self.wt.set_root_id('TREE_ROT')
     b = self.b = self.wt.branch
     b.nick = "test branch"
     self.wt.commit(message='initial null commit',
              committer='test@user',
              timestamp=1129025423, # 'Tue Oct 11 20:10:23 2005'
              timezone=0,
              rev_id='test@user-1')
     self.build_tree_contents([('hello', 'contents of hello file'),
                          ('src/', ),
                          ('src/foo.c', 'int main()\n{\n}\n')])
     self.wt.add(['hello', 'src', 'src/foo.c'],
                          ['hello-id', 'src-id', 'foo.c-id'])
     tt = TreeTransform(self.wt)
     trans_id = tt.trans_id_tree_path('hello')
     tt.set_executability(True, trans_id)
     tt.apply()
     self.wt.commit(message='add files and directories',
              timestamp=1129025483,
              timezone=36000,
              rev_id='test@user-2',
              committer='test@user')
Beispiel #3
0
def set_executability(wt, path, executable=True):
    """Set the executable bit for the file at path in the working tree

    os.chmod() doesn't work on windows. But TreeTransform can mark or
    unmark a file as executable.
    """
    file_id = wt.path2id(path)
    tt = TreeTransform(wt)
    try:
        tt.set_executability(executable, tt.trans_id_tree_file_id(file_id))
        tt.apply()
    finally:
        tt.finalize()