Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

restore_commit_times logging #3

Merged
merged 1 commit into from Mar 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions lumper/worker/build.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# encoding: utf-8

from time import time
import logging
import json
import os
Expand Down Expand Up @@ -136,6 +135,8 @@ def prepare(self, path):
@staticmethod
def restore_commit_times(path):

log.info("Restoring file mtimes for path:", path)

def walk(tree):
ret = list()
for i in tree:
Expand Down Expand Up @@ -165,15 +166,17 @@ def find_mtimes(repo):
ret[i.path] = t.authored_date
return ret

now = int(time())

for i, mtime in find_mtimes(repo).items():
os.utime(os.path.join(path, i), (now, mtime))
fname = os.path.join(path, i)
log.debug("%s %s", mtime, fname)
os.utime(fname, (mtime, mtime))

for sm in repo.submodules:
sm_repo = git.Repo(os.path.join(repo.git_dir, 'modules', sm.name))
for i, mtime in find_mtimes(sm_repo).items():
os.utime(os.path.join(path, sm.path, i), (now, mtime))
fname = os.path.join(path, sm.path, i)
log.debug("%s %s", mtime, fname)
os.utime(fname, (mtime, mtime))

def build(self, path):
tag = ("%s:%s" % (self.data['name'], self.data['tag'].lstrip("v"))).lower()
Expand Down