Closed Bug 376315 Opened 17 years ago Closed 17 years ago

Set up mercurial mirror of CVS

Categories

(mozilla.org Graveyard :: Server Operations, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: benjamin, Assigned: aravind)

Details

Attachments

(3 files, 6 obsolete files)

Attached file Import from CVS to HG, rev. 1 (obsolete) —
The script I am going to attach will create and maintain a mercurial mirror of the CVS repository for mozilla 2. It should be set up on a HG repository which is publicly available but only writable by this script (there will be no public checkins).

To initialize the repository, run

cvs2hg-import.py --inirepo <dir>

To do an import, run
cvs2hg-import.py --cvsroot=<cvsroot> <dir>

The import should be performed frequently, Ideally, it would be performed whenever there are unimported checkins in CVS, but it could probably be run just as well on a cron job or in a permanent loop. The script takes about 30 mins on my machine.

I'd like jst or vlad to review the script, before we set it up for use.
vlad/jst, can one of you look this over?
OS: Linux → All
Hardware: PC → All
It looks fine to me; for my personal use I tend to just do a client.mk update in a "clean" tree, though it's only bandwidth (and this will be running local to cvs anyway, I assume) that's the issue.
Tried the CVS import, failed with this message.

cvs checkout: Updating mozilla/xulrunner/stub
U mozilla/xulrunner/stub/Makefile.in
U mozilla/xulrunner/stub/nsXULStub.cpp
cvs checkout: Updating mozilla/xulrunner/util
Moving /tmp/tmpXvYOvtcvsimport/mozilla/parser to /repo/hg/mozilla/parser
Traceback (most recent call last):
  File "../cvs2hg-import.py", line 225, in ?
    ImportMozillaCVS(args[0], options.hg, options.cvsroot)
  File "../cvs2hg-import.py", line 178, in ImportMozillaCVS
    rename(source, dest)
OSError: [Errno 18] Invalid cross-device link
[hg@dm-svn01 mozilla]$                                  
Aravind, hrm, this was tested on a system where /tmp and the repo were on the same filesystem. If I add a flag to specify a tmpdir that's on the same filesystem, will that be sufficient?
Attached file Import from CVS to HG, rev. 1.1 (obsolete) —
Revised script takes an optional --tempdir parameter.
Attachment #260415 - Attachment is obsolete: true
Attached file cvs-trunk to hg import script. (obsolete) —
Fixed the calls to hg.
Attachment #260592 - Attachment is obsolete: true
Imported the current CVS trunk code in mercurial.

You can browse this at http://hg.mozilla.org/

I am keeping this bug open, since I still have to cron this, check security perms etc on the repo.
How often do you need the repo updated?
We were talking about nightly, even with a CVS lock down to speed up the process and guarantee a coherent snapshot. We need the ability to pick and choose when we merge from the 1.9 trunk mirror branch into the Mozilla 2 integration branch, and we may wish to do this two or more days in a row, as well as for any given day. Especially if there's a nightly hook-clearing protocol with QA in the a.m. and sheriffing, again.

/be
As I mentioned in private email, I don't see any way to do the mirror->integration branch merge automatically, because it will probably involve regular merging.

Personally, I would prefer that the mirroring happen as often as possible, if CVS server load will allow it. The finer the granularity of commits, the easier it is to merge when you have conflicts.

If coherence is likely to be an issue, we should check out by date.
Dbaron was in on the sync once per day idea. IIRC server load and coherence were both considerations. Checking out by date doesn't guarantee coherence with CVS locking, alas.

/be
I'd be quite happy with "as often as possible", since it would make it possible for those of us still working on 1.9 to use it rather than all keep our own copies.  Once per day probably wouldn't be sufficient for that.
Attached file Import from CVS to HG, rev. 2.1 (obsolete) —
It might help if toolkit gets imported! :)

Aravind, can you use this version instead? I just added "toolkit" to the list of things to import.
Attachment #260634 - Attachment is obsolete: true
Yeah whoops! r=me

Aravind, we need to check this script into VCS somewhere. Perhaps somewhere in mozilla/tools in CVS?
Do we really want to exclude non-Firefox apps from this mirror?
Okay, will modify the script to get toolkit as well. I have set this up in cron to sync every 6 hours.  Let me know if you want it done more frequently.

I will check this script into mozilla/tools.  Can this bug be closed now?
Sure!
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
(In reply to comment #15)
> Do we really want to exclude non-Firefox apps from this mirror?

I think so; it's not a general purpose mirror. It's for Mozilla 2.

See http://groups.google.com/group/mozilla.dev.platform/browse_frm/thread/7673df08a4e1a499/a5300dc31385d601#a5300dc31385d601

You're right, it could be a larger mirror, but as a matter of policy I think it should not be. A separate hg mirror of all of cvs-mirror could be set up, with different access control and no development model as we want for Mozilla 2. File another bug?

/be
Talked to bsmedberg and aravind about this, and there are a couple of things we wanted to have as artifacts of the cvs import:

-- Complete log (stdin/stderr) from the import
-- Import as of a well-known epoch date (the 1.9a3 tag is a good one; but we should actually tag CVS with the directories that were imported)
-- Import from cvs.m.o, not cvs-mirror.m.o

Reopening to tweak the script and re-run it.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch Import CVS to Hg, rev 2.2 (obsolete) — Splinter Review
Talked with Benjamin and Aravind about making these changes; this patch:

-- For the initial import, pull the CVS tree from a (known) tag; right now, this tag doesn't exist, but it will shortly.
-- Remove all the quiet options to hg/cvs; we want the output from these automated processes
-- Point at cvs.m.o, not cvs-mirror.m.o (implies that whomever is running this script has access to the cltbld key and can use it for this purpose)
-- Check in each "module" (which it really isn't that, but...) separately
-- Pull by date for imports.
-- Include the checkin "module", the branch it came from, and the pull date in the Hg checkin message.
Attachment #260754 - Attachment is obsolete: true
Comment on attachment 261307 [details] [diff] [review]
Import CVS to Hg, rev 2.2

I suppose this is ok. I'm not quite sure why you bothered with the importModules hash.

And it looks like you eat exceptions that happen during import, which means that the script will exit with a zero code. Is this what you intended?
(In reply to comment #21)
> (From update of attachment 261307 [details] [diff] [review])
> I suppose this is ok. I'm not quite sure why you bothered with the
> importModules hash.

I did this so that the commits into the Hg repository show up as separate commits. The reason I did *that* is so that when we change [branch] tags that we pull from, the commit messages reflect that. I suppose we could do it as one commit (which I'd prefer), and then build up a commit message that has all the details.

What do you think?

> And it looks like you eat exceptions that happen during import, which means
> that the script will exit with a zero code. Is this what you intended?

Nope; good catch; fixed.

Admittedly, my python is a bit rusty. :-/
Attachment #261307 - Attachment is obsolete: true
Benjamin pointed out that doing separate commits for these modules would cause NSPR/NSS to be entirely removed in those commits.

We still want the per module log messages to provide the most information possible, so take 3:

-- Fix a bug where mozilla wouldn't get the right tag
-- Move back to one Hg commit, but building up a message with specific information about each module
-- Make sure rmtree runs in the finally, since we re-raise the exception.
-- Use UTC for CVS pulls, like Tinderbox
Attachment #261399 - Attachment is obsolete: true
This is a bz2 compressed log file (with set -e/set -v) from the run I did to tag the CVS repo with the HG_REPO_INITIAL_IMPORT tag, which is a clone of the MOZILLA_1_9a3_RELEASE tag, but only applied to the areas that were actually checked into Hg.
2.2 take III looks correct
(In reply to comment #25)
> 2.2 take III looks correct

Great!

I'll get together with Aravind, and we'll run through it.

Can this be resolved now?  I think jst is actually syncing stuff back to the hg repo.
Yes, this can IMO be considered done now. There's still work to be done for automation of the cvs-trunk-mirror updates etc, but we'll open new bugs for that work.
Status: REOPENED → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
Product: mozilla.org → mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: