--exclude-device-files patch

Ben Escoto bescoto@stanford.edu
Wed, 09 Jan 2002 15:40:00 -0800


--==_Exmh_1614962832P
Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
Content-Id: <15388.1010619583.0@folly.Stanford.EDU>

------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <15388.1010619583.1@folly.Stanford.EDU>

Attached is a patch which seemed to fix the --exclude-device-files
option for Mike.  I'll incorporate it into the next version.  However,
I still don't know why the original error happened in the first place,
so let me know if anyone figures out which files cause that one.


--
Ben Escoto


------- =_aaaaaaaaaa0
Content-Type: text/patch; charset="us-ascii"
Content-ID: <15388.1010619583.2@folly.Stanford.EDU>
Content-Description: rdiff-backup.patch

--- rdiff-backup.old	Wed Jan  9 12:17:56 2002
+++ rdiff-backup	Wed Jan  9 12:15:31 2002
@@ -80,13 +80,27 @@
 	# further global changes can be propagated to the remote systems.
 	connections = []
 
+	# This list is used by the set function below.  When a new
+	# connection is created with init_connection, its Globals class
+	# will match this one for all the variables mentioned in this
+	# list.
+	changed_settings = []
+
 	def get(cls, name):
 		"""Return the value of something in this class"""
 		return cls.__dict__[name]
 	get = classmethod(get)
 
 	def set(cls, name, val):
-		"""Set the value of something in this class"""
+		"""Set the value of something in this class
+
+		Use this instead of writing the values directly if the setting
+		matters to remote sides.  This function updates the
+		changed_settings list, so other connections know to copy the
+		changes.
+
+		"""
+		cls.changed_settings.append(name)
 		cls.__dict__[name] = val
 	set = classmethod(set)
 
@@ -387,8 +401,13 @@
 		if self.subreducer:
 			self.branch_val = self.branch_reducer(self.branch_val,
 												  self.subreducer.getresult())
-		self.final_val = self.base_final(self.base_elem, self.base_init_val,
-										 self.branch_val)
+		if self.current_index is None:
+			# No input, set None as default value
+			self.final_val = None
+		else:
+			self.final_val = self.base_final(self.base_elem,
+											 self.base_init_val,
+											 self.branch_val)
 		self.calculated = 1
 
 	def __call__(self, indexed_elem):
@@ -3524,12 +3543,11 @@
 
 		conn.Log.setverbosity(Log.verbosity)
 		conn.Log.setterm_verbosity(Log.term_verbosity)
-		if Globals.change_source_perms:
-			conn.Globals.set('change_source_perms', 1)
+		for setting_name in Globals.changed_settings:
+			conn.Globals.set(setting_name, Globals.get(setting_name))
 
 		return conn
 
-
 	def CloseConnections(cls):
 		"""Close all connections"""
 		for conn in Globals.connections: conn.quit()
@@ -3593,10 +3611,10 @@
 		for opt, arg in optlist:
 			if opt == "-b" or opt == "--backup-mode": self.action = "backup"
 			elif opt == "--change-source-perms":
-				Globals.change_source_perms = 1
+				Globals.set('change_source_perms', 1)
 			elif opt == "--exclude": self.exclude_regstrs.append(arg)
 			elif opt == "--exclude-device-files":
-				Globals.exclude_device_files = 1
+				Globals.set('exclude_device_files', 1)
 			elif opt == "--exclude-mirror":
 				self.exclude_mirror_regstrs.append(arg)
 			elif opt == "--force": self.force = 1

------- =_aaaaaaaaaa0--

--==_Exmh_1614962832P
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Exmh version 2.5 01/15/2001

iD8DBQE8PNTL+owuOvknOnURAmAcAJ9nCUF+mKFQzzEcslXTPv00qa+M7ACfRH7K
iqN4W0xzL0NkNegTamzAnEs=
=CvFV
-----END PGP SIGNATURE-----

--==_Exmh_1614962832P--