mercurial/bundle2.py
changeset 24793 2ec894582ea2
parent 24743 a2ef1dc3b59b
child 24794 21f2e8f48ae1
--- a/mercurial/bundle2.py	Thu Apr 16 05:36:49 2015 -0400
+++ b/mercurial/bundle2.py	Thu Apr 16 03:15:28 2015 -0400
@@ -655,6 +655,15 @@
         self._generated = None
         self.mandatory = mandatory
 
+    def copy(self):
+        """return a copy of the part
+
+        The new part have the very same content but no partid assigned yet.
+        Parts with generated data cannot be copied."""
+        assert not util.safehasattr(self.data, 'next')
+        return self.__class__(self.type, self._mandatoryparams,
+                              self._advisoryparams, self._data, self.mandatory)
+
     # methods used to defines the part content
     def __setdata(self, data):
         if self._generated is not None: