Page MenuHomePhabricator

Add basic support for mirroring Mercurial repositories
ClosedPublic

Authored by richardvanvelzen on Jan 30 2014, 10:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 4, 12:10 PM
Unknown Object (File)
Wed, Dec 4, 12:10 PM
Unknown Object (File)
Wed, Dec 4, 12:10 PM
Unknown Object (File)
Wed, Dec 4, 12:04 PM
Unknown Object (File)
Tue, Dec 3, 1:35 PM
Unknown Object (File)
Nov 15 2024, 6:04 PM
Unknown Object (File)
Oct 25 2024, 3:44 PM
Unknown Object (File)
Oct 24 2024, 10:16 PM

Details

Summary

Ref T4338. Mercurial exits with exit code 1 and "no changes found" in stdout
when there's no changes. I've split up the pushRepositoryToMirror to make
the code a tad more readable.

It isn't perfect, but it works for me.

Test Plan

pushed some changes to my hosted repo. Saw them appearing in the
mirrored repo

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This looks good to me. Two thoughts:

  • Does tip exist in an empty repository? Specifically, will this command succeed if the repository is empty?
  • Do we need --force? Specifically, are there situations where we'll get a better outcome with it?
  • Do we need --new-branch? Specifically, will this choke when new branches are created?

For reference, I think the git version of this command is pretty aggressive about overwriting the remote, although I'm not completely sure how the --mirror flag behaves in all cases.

In any case, this looks like a huge step forward to me. If you hit any of those special cases, let me know and we can figure out what to do about them.

Closed by commit rP28fcb5711bc8 (authored by Richard van Velzen <rvanvelzen@expert-shops.com>, committed by @epriestley).

Good points. I had thought about the tip issue, which is probably true. This first version just pushes the tip to the remote instead of actually mirroring the entire repo.

--force *should* be enough in all cases:

Use --new-branch if you want to allow push to create a new named branch that is not present at the destination. This allows you to only create a new branch without forcing other changes.
Note: Extra care should be taken with the -f/--force option, which will push all new heads on all branches, an action which will almost always cause confusion for collaborators.

This basically means that --force implies --new-branch but it can be dangerous, in the same way that it's dangerous with git (it overwrites all changes on the remote).