Need help recovering after mistaken prune
Sietse Brouwer
sbbrouwer at gmail.com
Fri May 3 12:28:47 UTC 2024
Hi Ernie and Anton,
Anton wrote:
> Mind that the hg touch command is indeed the right tool in this situation,
but considering you tried it, seen the result and you deliberately
don't want to use it, I will suggest using a debug command.
My own use-case for an obslog-rollback is when I accidentally prune a
public commit, and I want to go back to that specific commit instead of
force-pushing a successor.
I have an alias to remove the last obsolescence marker; I repeat that until
the repository is back to the state I started. Hopefully it helps you, too?
It assumes POSIX shell, I don't know whether it will work on Windows.
obs.rmlast = !
# print obsmarkers, printing only the obslog index, take the last one
last_obsolete_marker = $($HG debugobsolete --index -T'{index}\n' | tail
-1)
# remove that index from the obslog
$HG debugobsolete --delete "$last_obsolete_marker"
Cheers,
Sietse
On Fri, 3 May 2024 at 14:07, Anton Shestakov <engored at gmail.com> wrote:
> чт, 2 мая 2024 г. в 17:46, Ernie Rael <errael at raelity.com>:
> >
> > Hi All, I screwed up big time,
> >
> > I was in the wrong directory when I executed
> >
> > $ hg prune 78
> > 1 changesets pruned
> > 94 new orphan changesets
> >
> > I tried "hg touch 78", but attempts to use evolve/rebase wants to do
> merge resolution and that's not an option. I there any way to patch this
> up? I wouldn't feel so much panic if this wasn't my home directory.
>
> Hopefully this isn't too late, but if you don't want to use evolve or
> rebase, then you can remove the obsmarker by a debug command. Mind
> that the hg touch command is indeed the right tool in this situation,
> but considering you tried it, seen the result and you deliberately
> don't want to use it, I will suggest using a debug command.
>
> The command is hg debugobsolete, it has a --delete flag that you could
> use to basically erase any trace of a prune. First you need to know
> the obsmarker index, you can do debugobsolete --index --rev 78
> --hidden, and then delete the prune obsmarker by giving --delete its
> index in the list (you can tell it's a prune marker from the
> "operation" metadata item).
> _______________________________________________
> Mercurial mailing list
> Mercurial at lists.mercurial-scm.org
> https://lists.mercurial-scm.org/mailman/listinfo/mercurial
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20240503/38a9683a/attachment.html>
More information about the Mercurial
mailing list