Merge lp:~bratdaking/backintime/bug-412470 into lp:backintime/1.0

Proposed by Bart de Koning
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bratdaking/backintime/bug-412470
Merge into: lp:backintime/1.0
Diff against target: 115 lines
2 files modified
CHANGES (+1/-0)
common/snapshots.py (+43/-38)
To merge this branch: bzr merge lp:~bratdaking/backintime/bug-412470
Reviewer Review Type Date Requested Status
Back In Time Team Pending
Review via email: mp+13381@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES'
2--- CHANGES 2009-05-27 14:52:37 +0000
3+++ CHANGES 2009-10-14 20:45:20 +0000
4@@ -5,6 +5,7 @@
5 * multiple profiles support
6 * GNOME: fix notification
7 * fix small bugs
8+* Fix bug in schedule per included folder (LP: #412470)
9
10 Version 0.9.26
11 * update translations from Launchpad
12
13=== modified file 'common/snapshots.py'
14--- common/snapshots.py 2009-05-14 13:27:37 +0000
15+++ common/snapshots.py 2009-10-14 20:45:20 +0000
16@@ -652,23 +652,27 @@
17 self.set_take_snapshot_message( 0, _('Create hard-links') )
18 logger.info( "Create hard-links" )
19
20- if force or len( ignore_folders ) == 0:
21- cmd = "cp -al \"%s\"* \"%s\"" % ( self.get_snapshot_path_to( prev_snapshot_id ), new_snapshot_path_to )
22- self._execute( cmd )
23- else:
24- for folder in include_folders:
25- prev_path = self.get_snapshot_path_to( prev_snapshot_id, folder )
26- new_path = self.get_snapshot_path_to( new_snapshot_id, folder )
27- tools.make_dirs( new_path )
28- cmd = "cp -alb \"%s\"* \"%s\"" % ( prev_path, new_path )
29- self._execute( cmd )
30+ # When schedule per included folders is enabled this did not work (cp -alb iso cp -al?)
31+ # This resulted in a complete rsync for the whole snapshot consuming time and space
32+ # The ignored folders were copied afterwards. To solve this, the whole last snapshot is now hardlinked
33+ # and rsync is called only for the folders that should be synced (without --delete-excluded).
34+ #if force or len( ignore_folders ) == 0:
35+ cmd = "cp -al \"%s\"* \"%s\"" % ( self.get_snapshot_path_to( prev_snapshot_id ), new_snapshot_path_to )
36+ self._execute( cmd )
37+ #else:
38+ # for folder in include_folders:
39+ # prev_path = self.get_snapshot_path_to( prev_snapshot_id, folder )
40+ # new_path = self.get_snapshot_path_to( new_snapshot_id, folder )
41+ # tools.make_dirs( new_path )
42+ # cmd = "cp -alb \"%s\"* \"%s\"" % ( prev_path, new_path )
43+ # self._execute( cmd )
44 else:
45 if not self._create_directory( new_snapshot_path_to ):
46 return False
47
48 #sync changed folders
49 logger.info( "Call rsync to take the snapshot" )
50- cmd = rsync_prefix + ' -v --delete-excluded ' + rsync_suffix + '"' + new_snapshot_path_to + '"'
51+ cmd = rsync_prefix + ' -v ' + rsync_suffix + '"' + new_snapshot_path_to + '"' # do not delete the excluded, as we will miss the hardlinks with files or folders that are scheduled for a later time
52 self.set_take_snapshot_message( 0, _('Take snapshot') )
53 self._execute( cmd, self._exec_rsync_callback )
54
55@@ -687,33 +691,34 @@
56 fileinfo_dict[item_path] = 1
57 self._save_path_info( fileinfo, item_path )
58
59- #copy ignored folders
60- if not force and len( prev_snapshot_id ) > 0 and len( ignore_folders ) > 0:
61- prev_fileinfo_dict = self.load_fileinfo_dict( prev_snapshot_id )
62-
63- for folder in ignore_folders:
64- prev_path = self.get_snapshot_path_to( prev_snapshot_id, folder )
65- new_path = self.get_snapshot_path_to( new_snapshot_id, folder )
66- tools.make_dirs( new_path )
67- cmd = "cp -alb \"%s/\"* \"%s\"" % ( prev_path, new_path )
68- self._execute( cmd )
69-
70- if len( prev_fileinfo_dict ) > 0:
71- #save permissions for all items to folder
72- item_path = '/'
73- prev_path_items = folder.strip( '/' ).split( '/' )
74- for item in items:
75- item_path = os.path.join( item_path, item )
76- if item_path not in fileinfo_dict and item_path in prev_fileinfo_dict:
77- self._save_path_info_line( fileinfo, item_path, prev_fileinfo_dict[item_path] )
78-
79- #save permission for all items in folder
80- for path, dirs, files in os.walk( new_path ):
81- dirs.extend( files )
82- for item in dirs:
83- item_path = os.path.join( path, item )[ len( path_to_explore ) : ]
84- if item_path not in fileinfo_dict and item_path in prev_fileinfo_dict:
85- self._save_path_info_line( fileinfo, item_path, prev_fileinfo_dict[item_path] )
86+ # We now copy on forehand, so copying afterwards is not necessary anymore
87+ ##copy ignored folders
88+ #if not force and len( prev_snapshot_id ) > 0 and len( ignore_folders ) > 0:
89+ # prev_fileinfo_dict = self.load_fileinfo_dict( prev_snapshot_id )
90+ #
91+ # for folder in ignore_folders:
92+ # prev_path = self.get_snapshot_path_to( prev_snapshot_id, folder )
93+ # new_path = self.get_snapshot_path_to( new_snapshot_id, folder )
94+ # tools.make_dirs( new_path )
95+ # cmd = "cp -alb \"%s/\"* \"%s\"" % ( prev_path, new_path )
96+ # self._execute( cmd )
97+ #
98+ # if len( prev_fileinfo_dict ) > 0:
99+ # #save permissions for all items to folder
100+ # item_path = '/'
101+ # prev_path_items = folder.strip( '/' ).split( '/' )
102+ # for item in items:
103+ # item_path = os.path.join( item_path, item )
104+ # if item_path not in fileinfo_dict and item_path in prev_fileinfo_dict:
105+ # self._save_path_info_line( fileinfo, item_path, prev_fileinfo_dict[item_path] )
106+
107+ # #save permission for all items in folder
108+ # for path, dirs, files in os.walk( new_path ):
109+ # dirs.extend( files )
110+ # for item in dirs:
111+ # item_path = os.path.join( path, item )[ len( path_to_explore ) : ]
112+ # if item_path not in fileinfo_dict and item_path in prev_fileinfo_dict:
113+ # self._save_path_info_line( fileinfo, item_path, prev_fileinfo_dict[item_path] )
114
115 fileinfo.close()
116

Subscribers

People subscribed via source and target branches