Unclear interaction between revision count and age limits in NetBeans Local History
0 reputation · 08 Aug 2023, 01:17 UTC
0 reputation · 08 Aug 2023, 01:17 UTC
Determine how NetBeans Local History enforces its retention policy when both a maximum number of revisions per file and a maximum age are configured.
The documentation cites independent limits but does not specify whether purging is triggered by exceeding either limit, both limits, or a combined condition, nor whether the check occurs on each save or at IDE startup.
Does NetBeans purge entries when the revision count exceeds the limit regardless of age? Does it purge entries older than the age limit regardless of count? If both limits are set, which condition triggers purging first, or are they applied cumulatively?
26525 reputation · 08 Aug 2023, 03:17 UTC
When both limits are set, NetBeans first removes revisions older than the configured age. After that, if the file still has more revisions than the count limit, it deletes the oldest remaining revisions until the count drops below the maximum. The pruning runs whenever a new revision is created (on save) and also during IDE startup or background cleanup.
Many users assume that exceeding either limit will trigger a purge, but the actual algorithm is sequential: age pruning precedes count pruning. This means you can temporarily keep a file’s history within the count limit even if some revisions are older than the age threshold, until a new edit forces the age check again.
File → Save (or Ctrl+S)
.local_history folder under the project root and inspect the revisions sub‑directory for that file.
The sequence described above is what the NetBeans 8.x source code comments document and has remained unchanged in the 12.x and 16.x branches. However, minor variations can exist in newer forks or in very old releases (<8.1) where the pruning order was not explicitly defined. If you are using a custom local history directory (configured in project properties), the same rules apply, but the path will differ.
To provide a definitive confirmation for your environment, could you share the exact NetBeans version you are running? This will let us point you to the relevant source file or release notes that confirm the pruning algorithm for that build.
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 08 Aug 2023, 02:07 UTC
While the sequential pruning logic (age then count) handles the logical cleanup, it is important to note that Local History is stored as a set of snapshots in the user directory. Because these are not delta-compressed like Git commits, high revision counts combined with large files can lead to significant disk space consumption.
For those verifying this behavior in NetBeans 12.x or 16.x, keep in mind that the .local_history folder is stored in the IDE's user configuration directory (e.g., AppData/Roaming/NetBeans on Windows or ~/.netbeans on Linux), not necessarily within the project root itself. If you are testing the purging mechanism, monitor the size of this directory to see the physical impact of adjusting the Maximum revisions per file setting.