comparison push_cmd.py @ 86:6ecdbd22eb1d

push_cmd: add option to push in stupid mode This is mostly useful for test coverage, to roundtrip in stupid mode.
author Patrick Mezard <pmezard@gmail.com>
date Fri, 14 Nov 2008 16:18:24 -0600
parents 05a0c4f6060f
children 1da7aafdd323
comparison
equal deleted inserted replaced
85:05a0c4f6060f 86:6ecdbd22eb1d
9 import utility_commands 9 import utility_commands
10 10
11 11
12 @util.register_subcommand('push') 12 @util.register_subcommand('push')
13 @util.register_subcommand('dcommit') # for git expats 13 @util.register_subcommand('dcommit') # for git expats
14 def push_revisions_to_subversion(ui, repo, hg_repo_path, svn_url, **opts): 14 def push_revisions_to_subversion(ui, repo, hg_repo_path, svn_url,
15 stupid=False, **opts):
15 """Push revisions starting at a specified head back to Subversion. 16 """Push revisions starting at a specified head back to Subversion.
16 """ 17 """
17 oldencoding = merc_util._encoding 18 oldencoding = merc_util._encoding
18 merc_util._encoding = 'UTF-8' 19 merc_util._encoding = 'UTF-8'
19 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path, 20 hge = hg_delta_editor.HgChangeReceiver(hg_repo_path,
41 old_children = repo[base_n].children() 42 old_children = repo[base_n].children()
42 # 2. Commit oldest revision that needs to be pushed 43 # 2. Commit oldest revision that needs to be pushed
43 base_revision = svn_commit_hashes[old_ctx.parents()[0].node()][0] 44 base_revision = svn_commit_hashes[old_ctx.parents()[0].node()][0]
44 commit_from_rev(ui, repo, old_ctx, hge, svn_url, base_revision) 45 commit_from_rev(ui, repo, old_ctx, hge, svn_url, base_revision)
45 # 3. Fetch revisions from svn 46 # 3. Fetch revisions from svn
46 r = fetch_command.fetch_revisions(ui, svn_url, hg_repo_path) 47 r = fetch_command.fetch_revisions(ui, svn_url, hg_repo_path,
48 stupid=stupid)
47 assert not r or r == 0 49 assert not r or r == 0
48 # 4. Find the new head of the target branch 50 # 4. Find the new head of the target branch
49 repo = hg.repository(ui, hge.path) 51 repo = hg.repository(ui, hge.path)
50 base_c = repo[base_n] 52 base_c = repo[base_n]
51 replacement = [c for c in base_c.children() if c not in old_children 53 replacement = [c for c in base_c.children() if c not in old_children