Felipe Contreras <felipe.contre...@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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to