Is there a "forget" command?


I’m most familiar with Mercurial, which provides a forget command. This allows me to remove a file from source control, without actually deleting the file. Is there an equivalent in BitKeeper? There doesn’t appear to be anything other than rm. Unless I can supply a key to gone which hasn’t actually been removed?


If I am reading the hg manpage for forget correctly, it will cause the file to be deleted on the next commit but will leave the user file (gfile in bk terms) as an untracked file (an ‘extra’ for bk).

It looks like the same thing in bk would look like this:

mv FILE FILE.tmp
bk rm FILE
mv FILE.tmp FILE

Help me out by saying why this is desirable.


I use it when I’ve accidentally committed things like generated files (binaries/documentation), editor swap files and the like before I’ve realised I should’ve added them to the list of ignored files.

Usually they are files I can safely destroy, it’s just convenient not to have to.


Ah. I see. So a bit different. It is, “You know that file I told you to include in the next commit? Forget about it.”

So bk uses a different model. The revision changes to files are tracked in ‘sfiles’ for each ‘gfile’. When you say bk new FILE it doesn’t mean, “When I make a commit next, include this file”. It actually creates a revision history file for FILE and leaves a “pending delta” for that file. So to revert that change you want to actually remove that pending delta.

So rather than bk rm I used above you want to use bk fix FILE instead. That will strip the pending deltas from FILE, but keep the sfile. It is very similar to bk stripdel -r.. FILE, but it doesn’t delete the user file (the gfile).


Is it correct that bk fix is an alias for bk collapse? That’s the man page I was presented with, when I looked it up using bk help

It certainly looks like that would help, if the files hadn’t been committed.

I think it’s slightly different, hg forget is more like “Forget this file, next commit”. You can forget files which have already been committed. It’s the same action as hg remove -Af.


So bk fix was an earlier version of bk collapse. bk collapse operates only on changesets, fix could operate
on files or changesets. All us old hands are used to bk fix but it was dicey so we decided not to document
it - it had corners where it didn’t work.

So we could have a bk forget and I think you could write it and it might be a fun way to learn more about
BK. There is a file called src/ and if you put a function in there named _forget() and build bk
then bk forget will call that function.

You might think about what you want bk forget to do and code it up. We’ll help by answering questions.


Yeah, I’d definitely be interested in trying that.


Some help is coming from our side: we’ve got a feature coming where you can create a bk-forget executable (shell script, C program, whatever) and when you run “bk forget” and it sees that on your path it runs it. It’s a small thing but they all help.

If you have questions on how you might implement bk forget we’re here, happy to answer them.