Page MenuHomePhabricator

Add "bin/repository prune" to destroy orphaned commits
Closed, DuplicatePublic

Description

Occasionally, bugs in either repository parsing or system configuration may result in phantom commits being visible in the Diffusion view (see https://secure.phabricator.com/T615#9). In cases such as this, it might be nice to have some mechanism to remove those phantom commits or to ask that Diffusion re-index the repository.

I'd imagine, from what I've learned about the internals of Phabricator, that this would be a fairly hairy operation - especially if there are existing audits on valid commits. It should probably be something done from the command line.

Event Timeline

wotte raised the priority of this task from to Needs Triage.
wotte updated the task description. (Show Details)
wotte added a project: Diffusion.
wotte added a subscriber: wotte.
epriestley added a subscriber: epriestley.

{T2581} is vaguely related, too.

We have:

phabricator/ $ bin/repository discover --repair

However, I believe this currently will only find commits which were missed due to a bug; it does not destroy commits which no longer appear in the repository, as is the case here.

This is kind of complicated, because even if commits are unreachable we shouldn't normally destroy them (for example, if someone deletes master by accident, they can restore it later, and we would be worse off if we'd deleted all the commits which are temporarily unreachable).

A workaround for now is to destroy and recreate the repository, with bin/repository delete.

This operation is probably not too hard to implement for repositories small enough for all of their commit hashes to fit in memory, I'd mostly just worry about well-meaning users running it when it isn't the best step they could take. I think this is also exceedingly rare (the T615 case is the first time I've seen it), although I could imagine we may start running into it more now that we support hosting.

epriestley lowered the priority of this task from Low to Wishlist.Dec 18 2013, 2:05 AM

D7748 fixed the immediate issue (--debug in Mercurial causing it to emit warnings to stdout), and these commits never existed in the database (they were display-time phantoms), so updating should fix them.

Adding some kind of prune command is still possibly reasonable, but we're down to 0 real-world cases where it would solve a problem.

epriestley renamed this task from Add mechanism to ask that Diffusion re-index either an entire repository or problem commits to Add "bin/repository prune" to destroy orphaned commits.Jan 3 2014, 10:17 PM