def run(self): # do regress the target directory if necessary if self.target.needs_regress(): ret_code = self.target.regress() if ret_code != 0: return ret_code previous_time = self.target.get_mirror_time() if previous_time < 0 or previous_time >= Time.curtime: self.log("Either there is more than one current_mirror or " "the last backup is not in the past. Aborting.", self.log.ERROR) return 1 elif previous_time: Time.setprevtime(previous_time) self.target.base_dir.conn.Main.backup_touch_curmirror_local( self.source.base_dir, self.target.base_dir) backup.Mirror_and_increment(self.source.base_dir, self.target.base_dir, self.target.incs_dir) self.target.base_dir.conn.Main.backup_remove_curmirror_local() else: backup.Mirror(self.source.base_dir, self.target.base_dir) self.target.base_dir.conn.Main.backup_touch_curmirror_local( self.source.base_dir, self.target.base_dir) self.target.base_dir.conn.Main.backup_close_statistics(time.time()) return 0
def run(self): # do regress the target directory if necessary if self._operate_regress(): # regress was necessary and failed return 1 previous_time = self.repo.get_mirror_time() if previous_time < 0 or previous_time >= Time.curtime: log.Log( "Either there is more than one current_mirror or " "the last backup is not in the past. Aborting.", log.ERROR) return 1 if Globals.get_api_version() < 201: # compat200 if previous_time: Time.setprevtime(previous_time) self.repo.base_dir.conn.Main.backup_touch_curmirror_local( self.dir.base_dir, self.repo.base_dir) backup.mirror_and_increment_compat200(self.dir.base_dir, self.repo.base_dir, self.repo.incs_dir) self.repo.base_dir.conn.Main.backup_remove_curmirror_local() else: backup.mirror_compat200(self.dir.base_dir, self.repo.base_dir) self.repo.base_dir.conn.Main.backup_touch_curmirror_local( self.dir.base_dir, self.repo.base_dir) self.repo.base_dir.conn.Main.backup_close_statistics(time.time()) else: # API 201 and higher if previous_time: Time.setprevtime(previous_time) self._operate_backup(previous_time) return 0
rf2 = getrp("two_hardlinked_files1") exec1 = getrp("executable") exec2 = getrp("executable2") sig = getrp("regular_file.sig") hl1, hl2 = map(getrp, ["two_hardlinked_files1", "two_hardlinked_files2"]) test = getrp("test") dir = getrp(".") sym = getrp("symbolic_link") nothing = getrp("nothing") target = rpath.RPath(lc, "testfiles/output/out") out2 = rpath.RPath(lc, "testfiles/output/out2") out_gz = rpath.RPath(lc, "testfiles/output/out.gz") Time.setcurtime(1000000000) Time.setprevtime(999424113) prevtimestr = "2001-09-02T02:48:33-07:00" t_pref = "testfiles/output/out.2001-09-02T02:48:33-07:00" t_diff = "testfiles/output/out.2001-09-02T02:48:33-07:00.diff" Globals.no_compression_regexp = \ re.compile(Globals.no_compression_regexp_string, re.I) class inctest(unittest.TestCase): """Test the incrementRP function""" def setUp(self): Globals.set('isbackup_writer', 1) MakeOutputDir() def check_time(self, rp):
rf2 = getrp("two_hardlinked_files1") exec1 = getrp("executable") exec2 = getrp("executable2") sig = getrp("regular_file.sig") hl1, hl2 = map(getrp, ["two_hardlinked_files1", "two_hardlinked_files2"]) test = getrp("test") dir = getrp(".") sym = getrp("symbolic_link") nothing = getrp("nothing") target = rpath.RPath(lc, "testfiles/output/out") out2 = rpath.RPath(lc, "testfiles/output/out2") out_gz = rpath.RPath(lc, "testfiles/output/out.gz") Time.setcurtime(1000000000) Time.setprevtime(999424113) prevtimestr = "2001-09-02T02:48:33-07:00" t_pref = "testfiles/output/out.2001-09-02T02:48:33-07:00" t_diff = "testfiles/output/out.2001-09-02T02:48:33-07:00.diff" Globals.no_compression_regexp = \ re.compile(Globals.no_compression_regexp_string, re.I) class inctest(unittest.TestCase): """Test the incrementRP function""" def setUp(self): Globals.set('isbackup_writer',1) MakeOutputDir() def check_time(self, rp): """Make sure that rp is an inc file, and time is Time.prevtime"""