Page MenuHomePhorge

Update the arc-hg.py extension to work with mercurial 6.4
ClosedPublic

Authored by speck on Apr 28 2023, 20:05.

Details

Summary

Mercurial 6.4 was recently released and showing up in package managers. With
the update to 6.4 using arc land would result in an exception indicating that
expandpath function does not exist.

The ui.expandpath function was deprecated in 5.8 and now removed in 6.4. The
functionality has been moved to utils.urlutil.get_ functions (they are split
between getting pull, push, and clone paths).

This updates the script to try utils.urlutil.get_clone_path function if the
ui.expandpath function is not present.

Imported from:

https://secure.phabricator.com/rARC0fc22183e796fb8ac2e3a0a3f3f37aa964c6d7fa

Test Plan

I updated my latest mercurial install to 6.4 and verified with hg --version.

I created a diff in a mercurial repo and used arc land to successfully land
the revision without any exceptions.

Closes T15288

Diff Detail

Repository
rARC Arcanist
Branch
mercurial
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 284
Build 284: arc lint + arc unit

Event Timeline

Thanks speck also for this patch in upstream Phorge :D

Hoping to be useful, here ready for merge

valerio.bozzolan edited the test plan for this revision. (Show Details)

I put +1 on this patch since I trust Evan completely but also because I like the try catch approach, trying to keep 100% backward compatibility. Thanks

sgtm

support/hg/arc-hg.py
276

✅ I see that you adopted another variable without overwriting source. I appreciated that.

288

✅ I can just say that the tuple url, path, branch seems correct to me

https://phab.mercurial-scm.org/D10401

(Nice! Mercurial was on Phabricator ihih)

This revision is now accepted and ready to land.Apr 29 2023, 09:18

Thanks for the thorough review

support/hg/arc-hg.py
276

Yeah I had do some digging in the mercurial source code to better understand these arguments. I probably should have renamed source to local_path as it's the path to the local repository on disk. If I remember correctly the mercurial source names this argument source which is likely why it was named this originally.

288

Good find on that phab revision -- I hadn't managed to find that one but was looking at others, gave up, cloned the mercurial source and started grepping~

It's unfortunate they no longer use phab. They've migrated to using heptapod which is a fork of gitlab that supports mercurial (I'm not 100% positive but I think they use hg-git to translate the mercurial commands on the server into git commands, so under the hood everything is still git)

Hi @speck, can I help to land this nice patch?

We really need to turn on T15042 so diffs can be landed from the webpage