Feature Request: Option to Add files Automatically in Versioned Directory

Bug #1912420 reported by stellarpower
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Breezy
Triaged
Wishlist
Unassigned

Bug Description

Hi,

I am often using VCS these days to manage projects and non-code files, for backup and monitoring puproses, and therefore my flow is pretty simple.

1. Create a project directory; `brz init`
2. Create some files and/or subdirectories
3. Add these to the versioning
4. `brz commit -m 'What I updated, date and time'`
5. GOTO 2

Most of the more advanced features haven't been necessary so far, and the most I'm likely to need is branching, diffing, and uncommitting over some mistakes.

The last part of this brings me to the process of needing to run add before commit. I've had a number of times now when I've forgotten to add a few new files, and these have been missed from the commit. Step 3 then can get quite messy often, involving `status`, `add`, one more `status` to check, `commit`, and especially if I have some ignored or unknown files I don't want to add, with the verbosity in my terminal now, I can make mistakes. The GUI for bazaar made this easier, but I'm not able to use this currently due to the python2 issues w1ith Focal. It would certainly be easier for me to have a cleaner terminal for version control, so I can usually just see a history of operations before me, as I always aim to do with ZFS snapshots too.

The highlight of bazaar/breezy over git for me is that it appears to offer the same (or close enough) feature set, but with much simpler, better-named, and more straightforward command syntax, which means I'm more likely to make proper use of it and not end up tiptoeing around touching anything when I do need to manage some conflicts in case I break it, something that happens with git. I also find the commands are quicker to run (in complexity, not runtime speed), and speeding up my workflow is a useful feature, that means I can concentrate on my work/code, and have VCS as something regular I run without much thought.

Therefore, I would like to propose an option to the `add` command, that, if given a directory, or symlink to a directory, would subsequently implicitly add any new entries under that directory to versioning. Let's say this option is called '--scan' (we could have --auto, --watch, ..., but I will use this for sake of example). Probably the simplest way to implement this would be to say that calling `brz add --scan myDirectory` would mean that before any relevant operation (such as a commit), the equivalent of running `brz add myDirectory` would occur before the main operation, and if there are any errors with the tree at this point, the main operation would not run. Thus, if any files were previously ignored or otherwise removed from versioning, the syntax would be clear in that the equivalernt of calling the `add` command over any previously scanned directories would be run, and so any implications of this would be as if the user did this step manually.

I may then make whatever changes I need in the scanned directories - add new files, add new subdirectories, rename files, and these would be picked up automatically before a commit, where presently, these will only be added to the commit if I ensure they have all been added correctly.

This would be useful for me, as

1. Often I want all files in my project directory versioned implicitly. I would prefer to add an entire directory to versioning and then explicitly ignore any files or folders that I don't want to be added, and then forget about the rest
2. This would help remove the chance I have missing files from my commits, something that is fairly regular now. Thus, I have a better guarantee that my commits are a snapshot of the directory at a specific time, and these are therefore more useful as a backup facility for me, whereas currently, I have to take it that in maybe 20% of cases, some file has slipped through the current because I didn't add everything that has changed in the whole tree, and will be encountered in the following one, breaking the idea that each commit for me represents some semantic step in my workflow where I want to create a snapshot.
3. It could reduce the complexity of required commands for commits and make the workflow much faster:
```
mkdir MyProject && cd MyProject
brz init .
brz add --scan .
brz commit -m 'Empty'
# Now start working on and changing files and folders in MyProject...
brz commit -m 'Comment 1...; 20/01/21 01h13'
brz commit -m 'Comment 2...; 21/01/21 16h43'
brz commit -m 'Comment 3...; 21/01/21 18h24'
...
```
4. Potentially extraneous, but a very simple script to take regular commits using only `sleep` and `date` could be used for snapshotting purposes, and this feature would make this simpler, as it would not need any user intervention to ensure that new or name-changed files and directories are added.

I understand that this might not be a popular feature with everyone, and would stress that if it is possible to add it to Breezy, it wouldn't break the logic of something else that I don't know about, I think it should be optional, and existing users could continue to use `add` as before without any changes to how this functions. It could be possible to use some sort of daemon mode too, i.e. inotifywatches, and whilst that might be overkill here, perhaps there would be reason to do so with some other feature request, meaning the two could be combined.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

"brz add" (without any arguments) will already add any unversioned files that are not versioned or ignored in the current directory. As a simple workaround, you could run "bzr add" before any invocation of "bzr commit".

Some sort of configuration option that causes breezy to automatically versioned unversioned files would be nice indeed. I thought there was an existing bug about this, but I can't find it at the moment.

Related bugs are:

* https://bugs.launchpad.net/bzr/+bug/448310

Changed in brz:
status: New → Triaged
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.