コード例 #1
0
ファイル: SyncArchive.py プロジェクト: tdfischer/homesync
 def addFiles(self, *files):
   self.commits+=1
   j = JobGroup()
   j.enqueue( Job(self.git.addToIndex, args=files) )
   j.enqueue( Job(self.git.commitIndex, args=("%i files added"%(len(files)),)) )
   if self.commits>100:
     #j.enqueue( Job(self.git.compact) ) #Make sure we compact after we commit and add
     self.commits=0
   self.jobs.enqueue(j)
   return j
コード例 #2
0
ファイル: SyncArchive.py プロジェクト: tdfischer/homesync
 def create(self):
   if self.backup:
     if os.path.exists(self.syncDir+"index"):
       self.log.debug("%s already exists, skipping creation.",self.syncDir)
       return False
     else:
       self.log.info("Creating new SyncArchive backup in %s"%(self.syncDir))
       initJob = JobGroup()
       initJob.enqueue( Job(self.git.init) )
       initJob.enqueue( Job(self.git.setConfig, args=("core.compression", -1)) )
   else:
     if os.path.exists(self.syncDir):
       self.log.debug("%s already exists, skipping creation.",self.syncDir)
       return False
     else:
       os.mkdir(self.syncDir)
       self.log.info("Creating new SyncArchive in %s"%(self.syncDir))
       initJob = JobGroup()
       initJob.enqueue( Job(self.git.init) )
       initJob.enqueue( Job(self.git.setConfig, args=("core.excludesfile", self.syncDir+"/ignore")) )
       initJob.enqueue( Job(self.git.setConfig, args=("core.compression", -1)) )
       initJob.setPriority(10)
       ignoreFile = open(self.syncDir+"/ignore","w")
       ignoreFile.writelines(map(lambda x:x+"\n",DEFAULT_IGNORES))
       ignoreFile.close()
   self.jobs.enqueue(initJob)