1

I contribute to a software development project which has a specificity:

  1. Multiple versions coexist, and there is a way to run any of those versions locally (to test a new feature or a bug fix).

  2. A distribution of a version uses about 2 GB of disk space, with a lot of files.

Currently, the workflow looks like this. If, say, I need to test my bug fix on versions A and B, I would:

  1. Copy the official distribution for version A from C:\references\A to C:\current.
  2. Compile my changes, overwriting some of the binaries in C:\current.
  3. Test the bug fix.
  4. Delete everything in C:\current.
  5. Copy C:\references\B to C:\current.
  6. Compile my changes, overwriting some of the binaries in C:\current.
  7. Test the bug fix.

Copying a large amount of files takes time. This delay breaks the flow. I thought about another approach, but I don't know if it is feasible.

In SQL Server, there is a thing called database snapshots. In essence, at a given moment, you ask the database to create a snapshot of the current data. Once it is created, any change can be made to the database—one can add or delete data, destroy entire tables, etc.—but at any moment, I can say that I want to go back to the snapshot, and all the changes made since this snapshot would disappear in a matter of milliseconds.

If there was a similar feature for NTFS, I would be able to do something like that:

  1. Create snapshot for C:\references.
  2. Compile my change in a way it overwrites some of the binaries in C:\references\A.
  3. Compile my change in a way it overwrites some of the binaries in C:\references\B.
  4. Once I'm happy with the changes, restore the state of C:\references using the original snapshot.

Is there a way to do it?

2 Answers2

1

Admittedly it seems hard to use, but you only need to work it out once.

Basilevs
  • 2,904
1

You can use Shadow copy to create a CoW snapshot of the directory and then switch between snapshots when testing

Shadow Copy (also known as Volume Snapshot Service, Volume Shadow Copy Service or VSS) is a technology included in Microsoft Windows that can create backup copies or snapshots of computer files or volumes, even when they are in use. It is implemented as a Windows service called the Volume Shadow Copy

It has some APIs and multiple command line tools to manage like diskshadow or vssadmin

Shadow Copies


Another feature for multiple file/folder versions is File History. It's meant for backups and uses a different underlying technology that operates at file level instead of block level like Shadow Copy

Shadow Copies


Both can be accessible via the Previous Versions tab in the Properties dialog

Previous versions Previous versions dialog

Note that you can directly double click the desired version in the dialog to get it instead of clicking Restore... button which replaces the whole directory structure

Of course you can also use any cloud file services that support multiple versions like OneDrive or Google Drive

See also

phuclv
  • 30,396
  • 15
  • 136
  • 260