All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jed Brown <jed@59A2.org>
To: Felipe Contreras <felipe.contreras@gmail.com>, git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Max Horn <max@quendi.de>,
	Antoine Pelisse <apelisse@gmail.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: Re: [RFC/PATH 3/4] remote-hg: add version checks to the marks
Date: Fri, 05 Apr 2013 07:46:20 -0500	[thread overview]
Message-ID: <8738v5qh5v.fsf@59A2.org> (raw)
In-Reply-To: <1365161779-32170-4-git-send-email-felipe.contreras@gmail.com>

Felipe Contreras <felipe.contreras@gmail.com> writes:

> @@ -76,12 +78,19 @@ class Marks:
>  
>      def __init__(self, path):
>          self.path = path
> +        self.clear()
> +        self.load()
> +
> +        if self.version < VERSION:
> +            self.clear()

It's friendlier to just upgrade the marks in-place. This takes less than
one second to run on repositories where full re-import would take half
an hour:

    def upgrade_marks(self, hgrepo):
        if self.marks_version == 1: # Convert from integer reversions to hgsha1
            warn("Upgrading marks-hg from hg sequence number to SHA1")
            self.marks_to_revisions = dict(
                (mark, hghex(hgrepo.changelog.node(int(rev))))
                for mark, rev in self.marks_to_revisions.iteritems())
            self.revisions_to_marks = dict(
                (hghex(hgrepo.changelog.node(int(rev))), mark)
                for rev, mark in self.revisions_to_marks.iteritems())
            self.marks_version = 2
            warn("Upgrade complete")

https://github.com/buchuki/gitifyhg/commit/23a6709efd14f3e058e3a846624b7677d1e8b497#L0R195

  reply	other threads:[~2013-04-06 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-05 11:36 [RFC/PATH 0/4] remoe-hg: switch to SHA-1 ids Felipe Contreras
2013-04-05 11:36 ` [RFC/PATH 1/4] remote-hg: shuffle some code Felipe Contreras
2013-04-05 11:36 ` [RFC/PATH 2/4] remote-hg: improve node traversing Felipe Contreras
2013-04-05 11:36 ` [RFC/PATH 3/4] remote-hg: add version checks to the marks Felipe Contreras
2013-04-05 12:46   ` Jed Brown [this message]
2013-04-05 22:29     ` Felipe Contreras
2013-04-05 11:36 ` [RFC/PATH 4/4] remote-hg: switch from revisions to SHA-1 noteids Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738v5qh5v.fsf@59A2.org \
    --to=jed@59a2.org \
    --cc=apelisse@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=max@quendi.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.