# ISourceControlProvider: Revert if unchanged?

**URL:** <https://forums.unrealengine.com/t/isourcecontrolprovider-revert-if-unchanged/365253>\
**Category:** C++\
**Tags:** version-control, unreal-engine, editor, Perforce, CPP, question\
**Created:** [July 26, 2016, 6:57pm UTC](https://forums.unrealengine.com/t/isourcecontrolprovider-revert-if-unchanged/365253 "2016-07-26T18:57:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_6034b9e0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6034b9e0](https://forums.unrealengine.com/u/anonymous_user_6034b9e0)\
**Post date:** [July 26, 2016, 6:57pm UTC](https://forums.unrealengine.com/t/isourcecontrolprovider-revert-if-unchanged/365253/1 "2016-07-26T18:57:24Z")

</div>

Is it possible to do the equivalent of `p4 revert -a` from C++ in the editor? I’m currently using `ISourceControlProvider::Execute(ISourceControlOperation::Create(), FileName)` to check out a file before writing it with `FFileHelper::SaveStringToFile`, but I’d like to avoid leaving the file checked out if there’s no change to the contents.

I could read the file and compare it before I check it out, but that’s somewhat inefficient, especially considering that Perforce already has an operation for reverting unchanged files.
