How to determine which files have been deleted before checkin?


#1

I looked in the man pages but it wasn’t obvious to me how to determine or mark files that have been deleted outside of “bk rm”


#2

Ok I see the deleted files under “bk -Au” but I am also seeing

  • ChangeSet
  • BitKeeper/etc/config
  • BitKeeper/etc/gone
  • BitKeeper/etc/ignore
  • BitKeeper/etc/collapsed

as well…


#3

You are talking about commit and marking files.

So I think you are coming from the git model where you remove a file and then run ‘git rm FILE’ to tell the system the file was deleted.

In bk, you shouldn’t remove a file directly. You need to use ‘bk rm FILE’ to actually remove the file because that renames the history file to BitKeeper/deleted and leaves that as a pending delta. The commit picks of the pending deltas and includes them in your cset.

So how to fix? ‘bk -U^G’ will list all files that are currently missing. If that list looks correct then try this:

   bk -U^G rm

This will remove those files.

Note that in bk having the file be missing but not deleted is normal behavior and it used to be the default behavior. When you checked-in a file it removed it and only later when you check-out a file again would it come back. (Make would auto-checkout files so this was find.) The checkout config modes set this behavior. See ‘bk help config-etc’. With current versions of bk checkout:edit is the default.


#4

You can list pending deltas (things that will get picked up in the next commit) with bk -Ap.

The files you listed (ChangeSet, config, gone, ignore, etc) are all BitKeeper metadata.


#5

Thanks @wscott. Since I use Xcode when working on iOS apps, it typically handles the addition and deletion of files (those files are maintained in a project file) and in mercurial my workflow consisted of me running “hg addremove” to sweep up all of the new and deleted files for the next commit. I imagine more devs might run into this who primarily use IDEs for their workflow. When I am writing in Go, I typically use SublimeText and add and remove by the command line anyway.

It now makes sense for me for a file to be missing but not “deleted”.


#6

Thanks @georgn. Running bk -Ap didn’t work for me as those files weren’t in pending status. I do like the flexibility of removing files I don’t need from my workspace (to save space) but not deleting from the repo itself


#7

I suspect XCode supports plugins to run your version control system and someone needs to write that.

Meanwhile, it sounds like you need a script to look at your repository and identify all the new files and run ‘bk new’ on them and identify all the files that got removed and run ‘bk rm’ on those.

We can query that information from bk using the gfiles comand:

$ bk gfiles -U^Gcxv
slc-G-- doc/bam/Makefile
slc-G-- doc/nested/Makefile
slc-G-- man/Makefile
slc-G-- man/man2html/Makefile
su----- src/zone.c
x------ src/newfile.c
  • -U Only use user files
  • -^G Show any files that are not checked out (the file was deleted, like zone.c in example)
  • -c Show any modified files
  • -x Show any extra files (not under version control or in ignore file)
  • -v Add the 7 column reason annotations so you can separate the reasons.

You can do this as separate calls (ie. bk -U^G rm; bk -Ux new) but if you repository is super large it is better to ask all your questions in one pass.

Or just run the ‘rm’ command and then ‘bk citool’ to identify everything else. It all does seems somewhat fragile so I will keep thinking about it.


#8

I filed a bug with Apple to support Mercurial (or at least vcs plugins) over 4 years ago… so yeah not holding my breath on that one :expressionless:

Thanks for the info… I originally looked at the gfiles man page before coming here and

-^G List files only if they are not checked out (“not gotten”)

didn’t register with me because the checkout mode was already set to edit (therefore checked out?). If there is a guide for developers coming from other vcs systems, I think a note about this kind of situation would be helpful.