git-remote-hg icon indicating copy to clipboard operation
git-remote-hg copied to clipboard

Avoid upcoming incompatibility with Mercurial 3.8

Open fingolfin opened this issue 9 years ago • 2 comments
trafficstars

In Mercurial 3.7, we now get this warning:

devel-warn: bm.write() is deprecated, use bm.recordchange(transaction)
(compatibility will be dropped after Mercurial-3.7, update your code.) at: /Users/mhorn/bin/git-remote-hg:403 (updatebookmarks)

First off: It's very nice that at least now they warn before making such changes!

Next, to fix this, we need to update the updatebookmarks function, which currently does this:

...
    if hasattr(localmarks, 'write'):
        localmarks.write()
    else:
        bookmarks.write(repo)

and it probably should be something like this instead:

    if check_version(3, 6):
        TODO
    elif hasattr(localmarks, 'write'):
        localmarks.write()
    else:
        bookmarks.write(repo)

The big question is that the "TODO" should be. We could temporarily create a transaction, then invoke bookmarks.recordchange(transaction) and close the transaction. This has the advantage of keeping the change local.

Or, we could start taking advantage of transactions in the git-remote-hg code. However, transactions haven't been around that long in Mercuriual... so probably better to go with the minimal change for now.

fingolfin avatar Feb 23 '16 08:02 fingolfin

@felipec did this: https://github.com/felipec/git-remote-hg/commit/822c6e4b03d9e66df8261f323caded716e8d8b8d

orivej avatar Mar 26 '17 15:03 orivej

Currently https://github.com/mnauw/git-remote-hg leads development of git-remote-hg and provides compatibility even with Hg 4.0. It seems better to merge your fork into @mnauw's than to continue independent development.

orivej avatar Mar 26 '17 16:03 orivej