mahsoud / boar

Automatically exported from code.google.com/p/boar
0 stars 0 forks source link

Detecting and skipping unchanged imports/commits #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
At the moment, when a user runs import on a directory and nothing has changed, 
the import is still committed. Is there a use case for this?

I'm not sure if this behavior is by design, or if it would perhaps be more 
intuitive to display an info/warning message to the user that nothing has 
changed and not create the new session or at the very least ask for 
confirmation from the user.

If this is by design, I'm just wondering what the use case for it is (sessions 
where nothing has changed).

Original issue reported on code.google.com by cryptob...@gmail.com on 15 Jan 2012 at 12:36

GoogleCodeExporter commented 9 years ago
Yes, unchanged commits/imports should by default be skipped. The current 
behavior is a consequence of the lazy programmer syndrome. 

Original comment by ekb...@gmail.com on 15 Jan 2012 at 10:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Related to this issue, having some function to "clean up" the sessions 
directory by unlinking session where nothing changed and correctly pointing the 
base_session to the last session where something actually changed would be 
great. 

I created some scripts that checked in folders by recursing over various 
directories to avoid having to go one at a time, and was using them to "update" 
the checkins having somehow gotten the idea that imports were nothing changed 
did not get checked in, so at the moment my session folder is cluttered with 
hundreds of sessions where nothing actually changed which also gunks up the 
list command with a bunch of checked in revisions that are empty.

Maybe this could be added to the veryify command? Or some new command or switch 
used to "clean" or use to update the repo when there are changes to the repo 
format.

Thanks!

Original comment by cryptob...@gmail.com on 19 Feb 2012 at 2:06

GoogleCodeExporter commented 9 years ago
I'm reluctant to add functionality to boar that makes destructive changes to 
the repository. As long as there is no code in there that can do such things, 
the odds are small of such events happening by accident...

However, it is very much possible to remove snapshots manually. The 
session.json file in every snapshot directory contains a "base_session" 
attribute, pointing at the snapshot that comes before itself in the session. 
So, if a session consists of snapshots 1, 2, and 3, with 2 containing no 
changes you proceed as follows:

1. Delete the entire snapshot 2 directory ("sessions/2" in your repo dir)
2. Edit "sessions/3/session.json" so that "base_session" points at snapshot 1.
3. (Optional so far, but may be enforced in the future) Calculate the new 
md5sum of "sessions/3/session.json" and replace the old value for 
"session.json" in "sessions/3/session.md5".
4. Perform a verification on the repo.

This method ONLY works if the deleted snapshots contains no changes 
(bloblist.json contains only "[]")

Of course, this operation should be classified as high risk. Make sure your 
backups are in order. 

Original comment by ekb...@gmail.com on 19 Feb 2012 at 8:23

GoogleCodeExporter commented 9 years ago
I think adding sth like this (in workdir.py):
        if len(new_files + modified_files + deleted_files) < 1:
            print "No changes to check-in."
            return self.revision
just after:
        unchanged_files, new_files, modified_files, deleted_files, ignored_files = \
        self.get_changes(self.revision, ignore_errors = ignore_errors)
would be sufficient to fix this issue :)

Original comment by mateuszk...@gmail.com on 2 May 2012 at 10:47

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision dfe0bcf32c30.

Original comment by ekb...@gmail.com on 21 May 2012 at 10:14

GoogleCodeExporter commented 9 years ago
Fixed in revision dfe0bcf32c30. Also added flag --allow-empty to "ci" and 
"import" to enable the old behavior.

Original comment by ekb...@gmail.com on 21 May 2012 at 10:17