/[rdiff-backup]/rdiff-backup/rdiff_backup/backup.py
ViewVC logotype

Diff of /rdiff-backup/rdiff_backup/backup.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by bescoto, Fri Nov 4 22:41:13 2005 UTC revision 1.35 by bescoto, Sat Nov 5 02:54:03 2005 UTC
# Line 477  class PatchITRB(rorpiter.ITRBranch): Line 477  class PatchITRB(rorpiter.ITRBranch):
477                          self.cached_rp = self.basis_root_rp.new_index(index)                          self.cached_rp = self.basis_root_rp.new_index(index)
478                  return self.cached_rp                  return self.cached_rp
479    
480            def check_long_name(self, func, *args):
481                    """Execute function, checking for ENAMETOOLONG error"""
482                    try: result = func(*args)
483                    except OSError, exc:
484                            if (errno.errorcode.has_key(exc[0]) and
485                                    errno.errorcode[exc[0]] == 'ENAMETOOLONG'):
486                                    self.error_handler(exc, args[0])
487                                    return None
488                            else: raise
489                    return result
490    
491          def can_fast_process(self, index, diff_rorp):          def can_fast_process(self, index, diff_rorp):
492                  """True if diff_rorp and mirror are not directories"""                  """True if diff_rorp and mirror are not directories"""
493                  rp = self.get_rp_from_root(index)                  rp = self.check_long_name(self.get_rp_from_root, index)
494                  return not diff_rorp.isdir() and not rp.isdir()                  # filename too long error qualifies (hack)
495                    return not rp or (not diff_rorp.isdir() and not rp.isdir())
496    
497          def fast_process(self, index, diff_rorp):          def fast_process(self, index, diff_rorp):
498                  """Patch base_rp with diff_rorp (case where neither is directory)"""                  """Patch base_rp with diff_rorp (case where neither is directory)"""
499                  rp = self.get_rp_from_root(index)                  rp = self.check_long_name(self.get_rp_from_root, index)
500                    if not rp: return
501                  tf = TempFile.new(rp)                  tf = TempFile.new(rp)
502                  if self.patch_to_temp(rp, diff_rorp, tf):                  if self.patch_to_temp(rp, diff_rorp, tf):
503                          if tf.lstat():                          if tf.lstat():
# Line 633  class IncrementITRB(PatchITRB): Line 646  class IncrementITRB(PatchITRB):
646                          self.cached_incrp = self.inc_root_rp.new_index(index)                          self.cached_incrp = self.inc_root_rp.new_index(index)
647                  return self.cached_incrp                  return self.cached_incrp
648    
         def inc_with_checking(self, new, old, inc_rp):  
                 """Produce increment taking new to old checking for errors"""  
                 try: inc = increment.Increment(new, old, inc_rp)  
                 except OSError, exc:  
                         if (errno.errorcode.has_key(exc[0]) and  
                                 errno.errorcode[exc[0]] == 'ENAMETOOLONG'):  
                                 self.error_handler(exc, old)  
                                 return None  
                         else: raise  
                 return inc  
   
649          def fast_process(self, index, diff_rorp):          def fast_process(self, index, diff_rorp):
650                  """Patch base_rp with diff_rorp and write increment (neither is dir)"""                  """Patch base_rp with diff_rorp and write increment (neither is dir)"""
651                  rp = self.get_rp_from_root(index)                  rp = self.check_long_name(self.get_rp_from_root, index)
652                    if not rp: return
653                  tf = TempFile.new(rp)                  tf = TempFile.new(rp)
654                  if self.patch_to_temp(rp, diff_rorp, tf):                  if self.patch_to_temp(rp, diff_rorp, tf):
655                          inc = self.inc_with_checking(tf, rp, self.get_incrp(index))                          inc = self.check_long_name(increment.Increment,
656                                                                               tf, rp, self.get_incrp(index))
657                          if inc is not None:                          if inc is not None:
658                                  self.CCPP.set_inc(index, inc)                                  self.CCPP.set_inc(index, inc)
659                                  if inc.isreg():                                  if inc.isreg():
# Line 669  class IncrementITRB(PatchITRB): Line 673  class IncrementITRB(PatchITRB):
673                  base_rp = self.base_rp = self.get_rp_from_root(index)                  base_rp = self.base_rp = self.get_rp_from_root(index)
674                  assert diff_rorp.isdir() or base_rp.isdir()                  assert diff_rorp.isdir() or base_rp.isdir()
675                  if diff_rorp.isdir():                  if diff_rorp.isdir():
676                          inc = self.inc_with_checking(diff_rorp, base_rp,                          inc = self.check_long_name(increment.Increment,
677                                                                                   self.get_incrp(index))                                                                   diff_rorp, base_rp, self.get_incrp(index))
678                          if inc and inc.isreg():                          if inc and inc.isreg():
679                                  inc.fsync_with_dir() # must write inc before rp changed                                  inc.fsync_with_dir() # must write inc before rp changed
680                          self.prepare_dir(diff_rorp, base_rp)                          self.prepare_dir(diff_rorp, base_rp)
681                  elif self.set_dir_replacement(diff_rorp, base_rp):                  elif self.set_dir_replacement(diff_rorp, base_rp):
682                          inc = self.inc_with_checking(self.dir_replacement, base_rp,                          inc = self.check_long_name(increment.Increment,
683                                                                                   self.get_incrp(index))                                                  self.dir_replacement, base_rp, self.get_incrp(index))
684                          if inc:                          if inc:
685                                  self.CCPP.set_inc(index, inc)                                  self.CCPP.set_inc(index, inc)
686                                  self.CCPP.flag_success(index)                                  self.CCPP.flag_success(index)

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26