view __init__.py @ 120:f508c1fa19a5

hg_delta_editor: do not assume branches are copied from trunk by default Here is what happen in jquery repository: - kelvin-dev branch is created in r1617 with an empty directory for the datePicker plugin - commits are done - datePicker plugin is merged in trunk Before the fix, the converter assumed the initial empty commit had for parent some other commit of trunk, therefore adding all its files, which was wrong. And we ended with 'alignDemo.html' in converted trunk@5946 while it was not in the source revision.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 29 Nov 2008 11:25:01 -0600
parents ed42f6e5705a
children 291925677a9f
line wrap: on
line source

import os

from mercurial import commands
from mercurial import hg

import svncommand
import fetch_command


def svn(ui, repo, subcommand, *args, **opts):
    return svncommand.svncmd(ui, repo, subcommand, *args, **opts)

def svn_fetch(ui, svn_url, hg_repo_path=None, **opts):
    if not hg_repo_path:
        hg_repo_path = hg.defaultdest(svn_url) + "-hg"
        ui.status("Assuming destination %s\n" % hg_repo_path)
    should_update = not os.path.exists(hg_repo_path)
    res = fetch_command.fetch_revisions(ui, svn_url, hg_repo_path, **opts)
    if (res is None or res == 0) and should_update:
        repo = hg.repository(ui, hg_repo_path)
        commands.update(ui, repo, repo['tip'].node())
    return res

commands.norepo += " svnclone"
cmdtable = {
    "svn":
        (svn,
         [('u', 'svn_url', '', 'Path to the Subversion server.'),
          ('', 'stupid', False, 'Be stupid and use diffy replay.'),
          ],
         svncommand.generate_help(),
         ),
    "svnclone" :(svn_fetch,
         [('S', 'skipto_rev', '0', 'Skip commits before this revision.'),
          ('', 'stupid', False, 'Be stupid and use diffy replay.'),
          ('T', 'tag_locations', 'tags', 'Relative path to where tags get '
           'stored, as comma sep. values if there is more than one such path.')
         ],
         'hg svn_fetch svn_url, dest'),
}