Merge pull request #1155 from scm-manager/bugfix/copy_on_write_for_data_store

Support copy and renamed modifications for hg
This commit is contained in:
eheimbuch
2020-05-18 15:40:38 +02:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Handle obscure line breaks in diff viewer ([#1129](https://github.com/scm-manager/scm-manager/pull/1129))
- Validate subversion client checksum ([#1113](https://github.com/scm-manager/scm-manager/issues/1113))
- Fix plugin manage permission ([#1135](https://github.com/scm-manager/scm-manager/pull/1135))
- Missing copy on write in the data store ([#1155](https://github.com/scm-manager/scm-manager/pull/1155))
## [2.0.0-rc7] - 2020-04-09
### Added

View File

@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package sonia.scm.store;
//~--- non-JDK imports --------------------------------------------------------
@@ -84,7 +84,10 @@ public class JAXBDataStore<T> extends FileBasedStore<T> implements DataStore<T>
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(item, file);
CopyOnWrite.withTemporaryFile(
temp -> marshaller.marshal(item, temp.toFile()),
file.toPath()
);
}
catch (JAXBException ex) {
throw new StoreException("could not write object with id ".concat(id),