def test_post_commit(self): # modify one file self.site.save_file('content/index.txt', 'different stuff') # add another new file self.site.save_file('content/newfile.txt', 'blah') # remove yet another self.site.delete_file('content/random.txt') # move a file filename1 = 'content/food.txt' filename2 = 'content/newfood.txt' self.site.save_file(filename2, self.site.load_file(filename1)) self.site.delete_file(filename1) # add all changes to index vc_add_tracked_and_new() vc_commit('hello') post_commit(self.site.site_root, self.app) expected = ChangedFiles(added=['content/newfile.txt'], modified=['content/index.txt'], deleted=['content/random.txt'], renamed={'content/food.txt': 'content/newfood.txt'}) test_plugin_name = 'yawtext.test.test_git.TestPlugin' plugin = self.app.extension_info[0][test_plugin_name] self.assertEquals(expected, plugin.changed)
def test_commit(self): # modify one file self.site.save_file('content/index.txt', 'different stuff') vc_add_tracked() vc_commit('hello') changed = vc_status() expected = ChangedFiles() self.assertEquals(expected, changed)
def _sync(strict, addnew, push, message): if not strict: # if addnew is True, this means we need to add all untracked files # to the index. The -A will do that. Otheriwse we just do a -u, # which will only update the tracked files. if addnew: vc_add_tracked_and_new() else: vc_add_tracked() # at this point we should have an almost snapshot of what we want # to commit in the index. It's "almost" because we now may want # to fix up or add the timestamps. call_plugins('on_pre_sync', vc_status()) # readjust the index with whatever changes were made by # the pre_sync plugins vc_add_tracked() vc_commit(message) if push: vc_push()