annotate hgsubversion/stupid.py @ 415:b17b2969861c

svnmeta: move revmap methods, make last_known_revision() more efficient
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Thu, 11 Jun 2009 10:32:32 +0200
parents 343da842dbe6
children cd6317fe70be
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 import cStringIO
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 import re
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 from mercurial import patch
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5 from mercurial import node
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 from mercurial import context
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
7 from mercurial import revlog
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8 from svn import core
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 import svnwrap
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
11 import svnexternals
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 import util
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15 binary_file_re = re.compile(r'''Index: ([^\n]*)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16 =*
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 Cannot display: file marked as a binary type.''')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 property_exec_set_re = re.compile(r'''Property changes on: ([^\n]*)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20 _*
25
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 11
diff changeset
21 (?:Added|Name): svn:executable
111
5497d1264b4d fetch_command: Fix mis-converted executable when svn:executable was set to the
Augie Fackler <durin42@gmail.com>
parents: 110
diff changeset
22 \+''')
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 property_exec_removed_re = re.compile(r'''Property changes on: ([^\n]*)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 _*
25
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 11
diff changeset
26 (?:Deleted|Name): svn:executable
111
5497d1264b4d fetch_command: Fix mis-converted executable when svn:executable was set to the
Augie Fackler <durin42@gmail.com>
parents: 110
diff changeset
27 -''')
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 empty_file_patch_wont_make_re = re.compile(r'''Index: ([^\n]*)\n=*\n(?=Index:)''')
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 any_file_re = re.compile(r'''^Index: ([^\n]*)\n=*\n''', re.MULTILINE)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 property_special_set_re = re.compile(r'''Property changes on: ([^\n]*)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34 _*
25
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 11
diff changeset
35 (?:Added|Name): svn:special
111
5497d1264b4d fetch_command: Fix mis-converted executable when svn:executable was set to the
Augie Fackler <durin42@gmail.com>
parents: 110
diff changeset
36 \+''')
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38 property_special_removed_re = re.compile(r'''Property changes on: ([^\n]*)
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 _*
25
99f8e4b535e9 svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents: 11
diff changeset
40 (?:Deleted|Name): svn:special
111
5497d1264b4d fetch_command: Fix mis-converted executable when svn:executable was set to the
Augie Fackler <durin42@gmail.com>
parents: 110
diff changeset
41 \-''')
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42
239
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
43
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
44 class BadPatchApply(Exception):
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
45 pass
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
46
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
47
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
48 def print_your_svn_is_old_message(ui): #pragma: no cover
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
49 ui.status("In light of that, I'll fall back and do diffs, but it won't do "
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
50 "as good a job. You should really upgrade your server.\n")
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
51
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
52
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
53 def mempatchproxy(parentctx, files):
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
54 # Avoid circular references patch.patchfile -> mempatch
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
55 patchfile = patch.patchfile
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
56
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
57 class mempatch(patchfile):
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
58 def __init__(self, ui, fname, opener, missing=False):
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
59 patchfile.__init__(self, ui, fname, None, False)
133
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 129
diff changeset
60
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
61 def readlines(self, fname):
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
62 if fname not in parentctx:
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
63 raise IOError('Cannot find %r to patch' % fname)
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
64 fctx = parentctx[fname]
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
65 data = fctx.data()
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
66 if 'l' in fctx.flags():
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
67 data = 'link ' + data
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
68 return cStringIO.StringIO(data).readlines()
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
69
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
70 def writelines(self, fname, lines):
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
71 files[fname] = ''.join(lines)
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
72
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
73 def unlink(self, fname):
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
74 files[fname] = None
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
75
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
76 return mempatch
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
77
200
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
78
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
79 def filteriterhunks(hg_editor):
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
80 iterhunks = patch.iterhunks
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
81 def filterhunks(ui, fp, sourcefile=None):
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
82 applycurrent = False
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
83 for data in iterhunks(ui, fp, sourcefile):
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
84 if data[0] == 'file':
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
85 if data[1][1] in hg_editor.meta.filemap:
200
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
86 applycurrent = True
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
87 else:
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
88 applycurrent = False
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
89 assert data[0] != 'git', 'Filtering git hunks not supported.'
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
90 if applycurrent:
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
91 yield data
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
92 return filterhunks
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
93
239
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
94
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
95 def diff_branchrev(ui, svn, hg_editor, branch, r, parentctx):
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
96 """Extract all 'branch' content at a given revision.
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
97
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
98 Return a tuple (files, filectxfn) where 'files' is the list of all files
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
99 in the branch at the given revision, and 'filectxfn' is a memctx compatible
109
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
100 callable to retrieve individual file information. Raise BadPatchApply upon
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
101 error.
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
102 """
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
103 def make_diff_path(branch):
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
104 if branch == 'trunk' or branch is None:
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
105 return 'trunk'
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
106 elif branch.startswith('../'):
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
107 return branch[3:]
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
108 return 'branches/%s' % branch
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
109 parent_rev, br_p = hg_editor.meta.get_parent_svn_branch_and_rev(r.revnum, branch)
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
110 diff_path = make_diff_path(branch)
109
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
111 try:
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
112 if br_p == branch:
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
113 # letting patch handle binaries sounded
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
114 # cool, but it breaks patch in sad ways
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
115 d = svn.get_unified_diff(diff_path, r.revnum, deleted=False,
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
116 ignore_type=False)
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
117 else:
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
118 d = svn.get_unified_diff(diff_path, r.revnum,
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
119 other_path=make_diff_path(br_p),
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
120 other_rev=parent_rev,
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
121 deleted=True, ignore_type=True)
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
122 if d:
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
123 raise BadPatchApply('branch creation with mods')
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
124 except svnwrap.SubversionRepoCanNotDiff:
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
125 raise BadPatchApply('subversion diffing code is not supported')
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
126 except core.SubversionException, e:
224
2165461d2dd8 Exception clean-ups; use symbolic names & avoid Python 2.6 deprecations.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 203
diff changeset
127 if (hasattr(e, 'apr_err') and e.apr_err != core.SVN_ERR_FS_NOT_FOUND):
109
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
128 raise
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
129 raise BadPatchApply('previous revision does not exist')
169
f1919e1c35bf fetch_command: cancel patching when encountering binary diffs
Patrick Mezard <pmezard@gmail.com>
parents: 168
diff changeset
130 if '\0' in d:
f1919e1c35bf fetch_command: cancel patching when encountering binary diffs
Patrick Mezard <pmezard@gmail.com>
parents: 168
diff changeset
131 raise BadPatchApply('binary diffs are not supported')
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
132 files_data = {}
128
bab5bcbbb3dc fetch_command: in stupid mode, load binary files when necessary
Patrick Mezard <pmezard@gmail.com>
parents: 127
diff changeset
133 binary_files = {}
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
134 touched_files = {}
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
135 for m in binary_file_re.findall(d):
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
136 # we have to pull each binary file by hand as a fulltext,
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
137 # which sucks but we've got no choice
128
bab5bcbbb3dc fetch_command: in stupid mode, load binary files when necessary
Patrick Mezard <pmezard@gmail.com>
parents: 127
diff changeset
138 binary_files[m] = 1
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
139 touched_files[m] = 1
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
140 d2 = empty_file_patch_wont_make_re.sub('', d)
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
141 d2 = property_exec_set_re.sub('', d2)
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
142 d2 = property_exec_removed_re.sub('', d2)
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
143 for f in any_file_re.findall(d):
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
144 # Here we ensure that all files, including the new empty ones
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
145 # are marked as touched. Content is loaded on demand.
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
146 touched_files[f] = 1
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
147 if d2.strip() and len(re.findall('\n[-+]', d2.strip())) > 0:
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
148 try:
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
149 oldpatchfile = patch.patchfile
200
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
150 olditerhunks = patch.iterhunks
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
151 patch.patchfile = mempatchproxy(parentctx, files_data)
200
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
152 patch.iterhunks = filteriterhunks(hg_editor)
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
153 try:
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
154 # We can safely ignore the changed list since we are
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
155 # handling non-git patches. Touched files are known
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
156 # by our memory patcher.
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
157 patch_st = patch.applydiff(ui, cStringIO.StringIO(d2),
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
158 {}, strip=0)
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
159 finally:
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
160 patch.patchfile = oldpatchfile
200
2e8c527f0456 stupid replay: Don't actually try and apply diffs to files we don't have anyway.
Augie Fackler <durin42@gmail.com>
parents: 198
diff changeset
161 patch.iterhunks = olditerhunks
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
162 except patch.PatchError:
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
163 # TODO: this happens if the svn server has the wrong mime
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
164 # type stored and doesn't know a file is binary. It would
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
165 # be better to do one file at a time and only do a
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
166 # full fetch on files that had problems.
109
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
167 raise BadPatchApply('patching failed')
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
168 for x in files_data.iterkeys():
186
6266ba36ee15 Create patch to make normal output much less verbose…
Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
parents: 185
diff changeset
169 ui.note('M %s\n' % x)
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
170 # if this patch didn't apply right, fall back to exporting the
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
171 # entire rev.
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
172 if patch_st == -1:
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
173 assert False, ('This should only happen on case-insensitive'
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
174 ' volumes.')
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
175 elif patch_st == 1:
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
176 # When converting Django, I saw fuzz on .po files that was
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
177 # causing revisions to end up failing verification. If that
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
178 # can be fixed, maybe this won't ever be reached.
109
460443a96497 fetch_command: only raise BadPatchApply() from stupid_diff_branchrev()
Patrick Mezard <pmezard@gmail.com>
parents: 108
diff changeset
179 raise BadPatchApply('patching succeeded with fuzz')
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
180 else:
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
181 ui.status('Not using patch for %s, diff had no hunks.\n' %
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
182 r.revnum)
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
183
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
184 exec_files = {}
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
185 for m in property_exec_removed_re.findall(d):
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
186 exec_files[m] = False
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
187 for m in property_exec_set_re.findall(d):
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
188 exec_files[m] = True
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
189 for m in exec_files:
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
190 touched_files[m] = 1
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
191 link_files = {}
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
192 for m in property_special_set_re.findall(d):
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
193 # TODO(augie) when a symlink is removed, patching will fail.
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
194 # We're seeing that above - there's gotta be a better
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
195 # workaround than just bailing like that.
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
196 assert m in files_data
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
197 link_files[m] = True
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
198 for m in property_special_removed_re.findall(d):
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
199 assert m in files_data
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
200 link_files[m] = False
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
201
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
202 for p in r.paths:
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
203 if p.startswith(diff_path) and r.paths[p].action == 'D':
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
204 p2 = p[len(diff_path)+1:].strip('/')
110
a4dcffaa6538 fetch_command: pass parent changectx instead of identifier
Patrick Mezard <pmezard@gmail.com>
parents: 109
diff changeset
205 if p2 in parentctx:
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
206 files_data[p2] = None
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
207 continue
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
208 # If this isn't in the parent ctx, it must've been a dir
127
7e45bcf52b64 fetch_command: patch files in memory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 119
diff changeset
209 files_data.update([(f, None) for f in parentctx if f.startswith(p2 + '/')])
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
210
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
211 for f in files_data:
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
212 touched_files[f] = 1
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
213
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
214 copies = getcopies(svn, hg_editor, branch, diff_path, r, touched_files,
110
a4dcffaa6538 fetch_command: pass parent changectx instead of identifier
Patrick Mezard <pmezard@gmail.com>
parents: 109
diff changeset
215 parentctx)
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
216
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
217 def filectxfn(repo, memctx, path):
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
218 if path in files_data and files_data[path] is None:
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
219 raise IOError()
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
220
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
221 if path in binary_files:
128
bab5bcbbb3dc fetch_command: in stupid mode, load binary files when necessary
Patrick Mezard <pmezard@gmail.com>
parents: 127
diff changeset
222 data, mode = svn.get_file(diff_path + '/' + path, r.revnum)
bab5bcbbb3dc fetch_command: in stupid mode, load binary files when necessary
Patrick Mezard <pmezard@gmail.com>
parents: 127
diff changeset
223 isexe = 'x' in mode
bab5bcbbb3dc fetch_command: in stupid mode, load binary files when necessary
Patrick Mezard <pmezard@gmail.com>
parents: 127
diff changeset
224 islink = 'l' in mode
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
225 else:
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
226 isexe = exec_files.get(path, 'x' in parentctx.flags(path))
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
227 islink = link_files.get(path, 'l' in parentctx.flags(path))
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
228 data = ''
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
229 if path in files_data:
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
230 data = files_data[path]
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
231 if islink:
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
232 data = data[len('link '):]
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
233 elif path in parentctx:
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
234 data = parentctx[path].data()
133
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 129
diff changeset
235
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
236 copied = copies.get(path)
128
bab5bcbbb3dc fetch_command: in stupid mode, load binary files when necessary
Patrick Mezard <pmezard@gmail.com>
parents: 127
diff changeset
237 return context.memfilectx(path=path, data=data, islink=islink,
bab5bcbbb3dc fetch_command: in stupid mode, load binary files when necessary
Patrick Mezard <pmezard@gmail.com>
parents: 127
diff changeset
238 isexec=isexe, copied=copied)
108
de19a13edfa8 fetch_command: extract diff code in a function
Patrick Mezard <pmezard@gmail.com>
parents: 107
diff changeset
239
129
59f8603a6641 fetch_command: in stupid mode, load file content on demand
Patrick Mezard <pmezard@gmail.com>
parents: 128
diff changeset
240 return list(touched_files), filectxfn
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
241
73
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
242 def makecopyfinder(r, branchpath, rootdir):
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
243 """Return a function detecting copies.
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
244
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
245 Returned copyfinder(path) returns None if no copy information can
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
246 be found or ((source, sourcerev), sourcepath) where "sourcepath" is the
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
247 copy source path, "sourcerev" the source svn revision and "source" is the
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
248 copy record path causing the copy to occur. If a single file was copied
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
249 "sourcepath" and "source" are the same, while file copies dectected from
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
250 directory copies return the copied source directory in "source".
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
251 """
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
252 # filter copy information for current branch
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
253 branchpath = branchpath + '/'
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
254 fullbranchpath = rootdir + branchpath
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
255 copies = []
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
256 for path, e in r.paths.iteritems():
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
257 if not e.copyfrom_path:
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
258 continue
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
259 if not path.startswith(branchpath):
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
260 continue
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
261 if not e.copyfrom_path.startswith(fullbranchpath):
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
262 # ignore cross branch copies
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
263 continue
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
264 dest = path[len(branchpath):]
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
265 source = e.copyfrom_path[len(fullbranchpath):]
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
266 copies.append((dest, (source, e.copyfrom_rev)))
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
267
163
fdc249cd1a0a Combine sort and reverse.
Martin Geisler <mg@daimi.au.dk>
parents: 158
diff changeset
268 copies.sort(reverse=True)
73
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
269 exactcopies = dict(copies)
101
a3b717e4abf5 Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents: 98
diff changeset
270
73
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
271 def finder(path):
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
272 if path in exactcopies:
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
273 return exactcopies[path], exactcopies[path][0]
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
274 # look for parent directory copy, longest first
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
275 for dest, (source, sourcerev) in copies:
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
276 dest = dest + '/'
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
277 if not path.startswith(dest):
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
278 continue
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
279 sourcepath = source + '/' + path[len(dest):]
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
280 return (source, sourcerev), sourcepath
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
281 return None
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
282
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
283 return finder
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
284
110
a4dcffaa6538 fetch_command: pass parent changectx instead of identifier
Patrick Mezard <pmezard@gmail.com>
parents: 109
diff changeset
285 def getcopies(svn, hg_editor, branch, branchpath, r, files, parentctx):
73
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
286 """Return a mapping {dest: source} for every file copied into r.
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
287 """
110
a4dcffaa6538 fetch_command: pass parent changectx instead of identifier
Patrick Mezard <pmezard@gmail.com>
parents: 109
diff changeset
288 if parentctx.node() == revlog.nullid:
73
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
289 return {}
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
290
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
291 # Extract svn copy information, group them by copy source.
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
292 # The idea is to duplicate the replay behaviour where copies are
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
293 # evaluated per copy event (one event for all files in a directory copy,
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
294 # one event for single file copy). We assume that copy events match
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
295 # copy sources in revision info.
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
296 svncopies = {}
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
297 finder = makecopyfinder(r, branchpath, svn.subdir)
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
298 for f in files:
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
299 copy = finder(f)
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
300 if copy:
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
301 svncopies.setdefault(copy[0], []).append((f, copy[1]))
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
302 if not svncopies:
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
303 return {}
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
304
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
305 # cache changeset contexts and map them to source svn revisions
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
306 ctxs = {}
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
307 def getctx(svnrev):
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
308 if svnrev in ctxs:
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
309 return ctxs[svnrev]
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
310 changeid = hg_editor.meta.get_parent_revision(svnrev + 1, branch)
73
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
311 ctx = None
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
312 if changeid != revlog.nullid:
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
313 ctx = hg_editor.repo.changectx(changeid)
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
314 ctxs[svnrev] = ctx
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
315 return ctx
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
316
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
317 # check svn copies really make sense in mercurial
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
318 hgcopies = {}
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
319 for (sourcepath, rev), copies in svncopies.iteritems():
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
320 sourcectx = getctx(rev)
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
321 if sourcectx is None:
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
322 continue
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
323 sources = [s[1] for s in copies]
410
eb524b957345 move aresamefiles() from HgChangeReceiver to util
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 409
diff changeset
324 if not util.aresamefiles(sourcectx, parentctx, sources):
73
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
325 continue
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
326 hgcopies.update(copies)
9c1b53abefcb fetch_command: support svn copy detection in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 63
diff changeset
327 return hgcopies
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
328
239
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
329 def fetch_externals(svn, branchpath, r, parentctx):
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
330 """Extract svn:externals for the current revision and branch
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
331
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
332 Return an externalsfile instance or None if there are no externals
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
333 to convert and never were.
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
334 """
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
335 externals = svnexternals.externalsfile()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
336 if '.hgsvnexternals' in parentctx:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
337 externals.read(parentctx['.hgsvnexternals'].data())
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
338 # Detect property additions only, changes are handled by checking
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
339 # existing entries individually. Projects are unlikely to store
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
340 # externals on many different root directories, so we trade code
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
341 # duplication and complexity for a constant lookup price at every
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
342 # revision in the common case.
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
343 dirs = set(externals)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
344 if parentctx.node() == revlog.nullid:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
345 dirs.update([p for p,k in svn.list_files(branchpath, r.revnum) if k == 'd'])
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
346 dirs.add('')
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
347 else:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
348 branchprefix = branchpath + '/'
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
349 for path, e in r.paths.iteritems():
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
350 if e.action == 'D':
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
351 continue
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
352 if not path.startswith(branchprefix) and path != branchpath:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
353 continue
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
354 kind = svn.checkpath(path, r.revnum)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
355 if kind != 'd':
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
356 continue
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
357 path = path[len(branchprefix):]
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
358 dirs.add(path)
184
d3ea6c98a086 Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 182
diff changeset
359 if e.action == 'M' or (e.action == 'A' and e.copyfrom_path):
d3ea6c98a086 Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 182
diff changeset
360 # Do not recurse in copied directories, changes are marked
d3ea6c98a086 Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 182
diff changeset
361 # as 'M', except for the copied one.
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
362 continue
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
363 for child, k in svn.list_files(branchprefix + path, r.revnum):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
364 if k == 'd':
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
365 dirs.add((path + '/' + child).strip('/'))
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
366
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
367 # Retrieve new or updated values
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
368 for dir in dirs:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
369 try:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
370 values = svn.list_props(branchpath + '/' + dir, r.revnum)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
371 externals[dir] = values.get('svn:externals', '')
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
372 except IOError:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
373 externals[dir] = ''
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
374
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
375 if not externals and '.hgsvnexternals' not in parentctx:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
376 # Do not create empty externals files
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
377 return None
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
378 return externals
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents: 169
diff changeset
379
239
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
380
e2214c8fc91f Put all stupid stuff in it's own module (separate from fetch-command).
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
381 def fetch_branchrev(svn, hg_editor, branch, branchpath, r, parentctx):
77
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
382 """Extract all 'branch' content at a given revision.
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
383
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
384 Return a tuple (files, filectxfn) where 'files' is the list of all files
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
385 in the branch at the given revision, and 'filectxfn' is a memctx compatible
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
386 callable to retrieve individual file information.
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
387 """
87
b033d74be76b fetch_command: in stupid non-diffy mode, take changed paths in account
Patrick Mezard <pmezard@gmail.com>
parents: 79
diff changeset
388 files = []
110
a4dcffaa6538 fetch_command: pass parent changectx instead of identifier
Patrick Mezard <pmezard@gmail.com>
parents: 109
diff changeset
389 if parentctx.node() == revlog.nullid:
88
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
390 # Initial revision, fetch all files
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
391 for path, kind in svn.list_files(branchpath, r.revnum):
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
392 if kind == 'f':
87
b033d74be76b fetch_command: in stupid non-diffy mode, take changed paths in account
Patrick Mezard <pmezard@gmail.com>
parents: 79
diff changeset
393 files.append(path)
88
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
394 else:
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
395 branchprefix = branchpath + '/'
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
396 for path, e in r.paths.iteritems():
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
397 if not path.startswith(branchprefix):
87
b033d74be76b fetch_command: in stupid non-diffy mode, take changed paths in account
Patrick Mezard <pmezard@gmail.com>
parents: 79
diff changeset
398 continue
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
399 if not hg_editor.meta._is_path_valid(path):
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 176
diff changeset
400 continue
88
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
401 kind = svn.checkpath(path, r.revnum)
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
402 path = path[len(branchprefix):]
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
403 if kind == 'f':
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
404 files.append(path)
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
405 elif kind == 'd':
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
406 if e.action == 'M':
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
407 continue
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
408 dirpath = branchprefix + path
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
409 for child, k in svn.list_files(dirpath, r.revnum):
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
410 if k == 'f':
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
411 files.append(path + '/' + child)
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
412 else:
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
413 if path in parentctx:
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
414 files.append(path)
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
415 continue
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
416 # Assume it's a deleted directory
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
417 path = path + '/'
3b60f223893a fetch_command: handle nullid parent in stupid non-diffy mode
Patrick Mezard <pmezard@gmail.com>
parents: 87
diff changeset
418 deleted = [f for f in parentctx if f.startswith(path)]
101
a3b717e4abf5 Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents: 98
diff changeset
419 files += deleted
87
b033d74be76b fetch_command: in stupid non-diffy mode, take changed paths in account
Patrick Mezard <pmezard@gmail.com>
parents: 79
diff changeset
420
110
a4dcffaa6538 fetch_command: pass parent changectx instead of identifier
Patrick Mezard <pmezard@gmail.com>
parents: 109
diff changeset
421 copies = getcopies(svn, hg_editor, branch, branchpath, r, files, parentctx)
101
a3b717e4abf5 Cleanups based on pyflakes output.
Augie Fackler <durin42@gmail.com>
parents: 98
diff changeset
422
77
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
423 def filectxfn(repo, memctx, path):
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
424 data, mode = svn.get_file(branchpath + '/' + path, r.revnum)
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
425 isexec = 'x' in mode
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
426 islink = 'l' in mode
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
427 copied = copies.get(path)
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
428 return context.memfilectx(path=path, data=data, islink=islink,
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
429 isexec=isexec, copied=copied)
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
430
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
431 return files, filectxfn
ed3dd5bf45da fetch_command: bypass export3() and checkout manually
Patrick Mezard <pmezard@gmail.com>
parents: 76
diff changeset
432
373
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
433 def checkbranch(hg_editor, r, branch):
415
b17b2969861c svnmeta: move revmap methods, make last_known_revision() more efficient
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 414
diff changeset
434 branchedits = hg_editor.meta.revmap.branchedits(branch, r)
373
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
435 if not branchedits:
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
436 return None
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
437 branchtip = branchedits[0][1]
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
438 for child in hg_editor.repo[branchtip].children():
375
af9fc01299b4 Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 374
diff changeset
439 b = child.branch() != 'default' and child.branch() or None
af9fc01299b4 Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 374
diff changeset
440 if b == branch and child.extra().get('close'):
373
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
441 return None
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
442 return branchtip
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
443
412
5cba60948f92 stupid: eliminate dependency on editor.current
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 411
diff changeset
444 def branches_in_paths(hge, tbdelta, paths, revnum, checkpath, listdir):
377
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
445 '''Given a list of paths, return mapping of all branches touched
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
446 to their branch path.
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
447 '''
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
448 branches = {}
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
449 paths_need_discovery = []
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
450 for p in paths:
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
451 relpath, branch, branchpath = hge.meta._split_branch_path(p)
377
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
452 if relpath is not None:
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
453 branches[branch] = branchpath
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
454 elif paths[p].action == 'D' and not hge.meta._is_path_tag(p):
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
455 ln = hge.meta._localname(p)
377
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
456 # must check in branches_to_delete as well, because this runs after we
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
457 # already updated the branch map
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
458 if ln in hge.meta.branches or ln in tbdelta['branches'][1]:
377
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
459 branches[ln] = p
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
460 else:
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
461 paths_need_discovery.append(p)
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
462
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
463 if not paths_need_discovery:
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
464 return branches
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
465
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
466 paths_need_discovery = [(len(p), p) for p in paths_need_discovery]
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
467 paths_need_discovery.sort()
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
468 paths_need_discovery = [p[1] for p in paths_need_discovery]
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
469 actually_files = []
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
470 while paths_need_discovery:
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
471 p = paths_need_discovery.pop(0)
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
472 path_could_be_file = True
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
473 ind = 0
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
474 while ind < len(paths_need_discovery) and not paths_need_discovery:
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
475 if op.startswith(p):
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
476 path_could_be_file = False
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
477 ind += 1
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
478 if path_could_be_file:
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
479 if checkpath(p, revnum) == 'f':
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
480 actually_files.append(p)
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
481 # if there's a copyfrom_path and there were files inside that copyfrom,
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
482 # we need to detect those branches. It's a little thorny and slow, but
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
483 # seems to be the best option.
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
484 elif paths[p].copyfrom_path and not p.startswith('tags/'):
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
485 paths_need_discovery.extend(['%s/%s' % (p,x[0])
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
486 for x in listdir(p, revnum)
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
487 if x[1] == 'f'])
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
488
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
489 if not actually_files:
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
490 continue
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
491
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
492 filepaths = [p.split('/') for p in actually_files]
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
493 filepaths = [(len(p), p) for p in filepaths]
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
494 filepaths.sort()
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
495 filepaths = [p[1] for p in filepaths]
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
496 while filepaths:
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
497 path = filepaths.pop(0)
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
498 parentdir = '/'.join(path[:-1])
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
499 filepaths = [p for p in filepaths if not '/'.join(p).startswith(parentdir)]
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
500 branchpath = hge.meta._normalize_path(parentdir)
377
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
501 if branchpath.startswith('tags/'):
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
502 continue
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
503 branchname = hge.meta._localname(branchpath)
377
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
504 if branchpath.startswith('trunk/'):
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
505 branches[hge.meta._localname('trunk')] = 'trunk'
377
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
506 continue
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
507 if branchname and branchname.startswith('../'):
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
508 continue
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
509 branches[branchname] = branchpath
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
510
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
511 return branches
7e9269555e72 Move HgChangeReceiver.branches_in_paths() to the stupid module.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 376
diff changeset
512
367
ce64d57172a3 Generate separate data structure containing revision's tags/branches changes.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 366
diff changeset
513 def convert_rev(ui, hg_editor, svn, r, tbdelta):
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
514 # this server fails at replay
367
ce64d57172a3 Generate separate data structure containing revision's tags/branches changes.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 366
diff changeset
515
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
516 hg_editor.meta.save_tbdelta(tbdelta)
412
5cba60948f92 stupid: eliminate dependency on editor.current
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 411
diff changeset
517 branches = branches_in_paths(hg_editor, tbdelta, r.paths, r.revnum,
5cba60948f92 stupid: eliminate dependency on editor.current
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 411
diff changeset
518 svn.checkpath, svn.list_files)
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
519 brpaths = branches.values()
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
520 bad_branch_paths = {}
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
521 for br, bp in branches.iteritems():
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
522 bad_branch_paths[br] = []
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
523
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
524 # This next block might be needed, but for now I'm omitting it until it can be
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
525 # proven necessary.
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
526 # for bad in brpaths:
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
527 # if bad.startswith(bp) and len(bad) > len(bp):
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
528 # bad_branch_paths[br].append(bad[len(bp)+1:])
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
529
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
530 # We've go a branch that contains other branches. We have to be careful to
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
531 # get results similar to real replay in this case.
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
532 for existingbr in hg_editor.meta.branches:
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
533 bad = hg_editor.meta._remotename(existingbr)
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
534 if bad.startswith(bp) and len(bad) > len(bp):
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
535 bad_branch_paths[br].append(bad[len(bp)+1:])
373
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
536
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
537 deleted_branches = {}
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
538 for p in r.paths:
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
539 if hg_editor.meta._is_path_tag(p):
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 200
diff changeset
540 continue
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
541 branch = hg_editor.meta._localname(p)
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
542 if not (r.paths[p].action == 'R' and branch in hg_editor.meta.branches):
373
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
543 continue
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
544 closed = checkbranch(hg_editor, r, branch)
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
545 if closed is not None:
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
546 deleted_branches[branch] = closed
237
c90cfa665b81 Cope with date-less revisions.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 234
diff changeset
547
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
548 date = hg_editor.meta.fixdate(r.date)
147
22162380c4b9 Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents: 141
diff changeset
549 check_deleted_branches = set()
0
f2636cfed115 Initial import of hgsubversion into a public repository.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
550 for b in branches:
401
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
551
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
552 parentctx = hg_editor.repo[hg_editor.meta.get_parent_revision(r.revnum, b)]
147
22162380c4b9 Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents: 141
diff changeset
553 if parentctx.branch() != (b or 'default'):
22162380c4b9 Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents: 141
diff changeset
554 check_deleted_branches.add(b)
401
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
555
119
ea65fe2b0856 hg_delta_editor: fix update of stray files in branches/
Patrick Mezard <pmezard@gmail.com>
parents: 118
diff changeset
556 kind = svn.checkpath(branches[b], r.revnum)
ea65fe2b0856 hg_delta_editor: fix update of stray files in branches/
Patrick Mezard <pmezard@gmail.com>
parents: 118
diff changeset
557 if kind != 'd':
ea65fe2b0856 hg_delta_editor: fix update of stray files in branches/
Patrick Mezard <pmezard@gmail.com>
parents: 118
diff changeset
558 # Branch does not exist at this revision. Get parent revision and
ea65fe2b0856 hg_delta_editor: fix update of stray files in branches/
Patrick Mezard <pmezard@gmail.com>
parents: 118
diff changeset
559 # remove everything.
133
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 129
diff changeset
560 deleted_branches[b] = parentctx.node()
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 129
diff changeset
561 continue
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 176
diff changeset
562
401
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
563 try:
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
564 files_touched, filectxfn2 = diff_branchrev(
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
565 ui, svn, hg_editor, b, r, parentctx)
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
566 except BadPatchApply, e:
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
567 # Either this revision or the previous one does not exist.
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
568 ui.status("Fetching entire revision: %s.\n" % e.args[0])
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
569 files_touched, filectxfn2 = fetch_branchrev(
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
570 svn, hg_editor, b, branches[b], r, parentctx)
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
571
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
572 externals = fetch_externals(svn, branches[b], r, parentctx)
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
573 if externals is not None:
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
574 files_touched.append('.hgsvnexternals')
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
575
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
576 def filectxfn(repo, memctx, path):
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
577 if path == '.hgsvnexternals':
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
578 if not externals:
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
579 raise IOError()
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
580 return context.memfilectx(path=path, data=externals.write(),
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
581 islink=False, isexec=False, copied=None)
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
582 for bad in bad_branch_paths[b]:
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
583 if path.startswith(bad):
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
584 raise IOError()
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
585 return filectxfn2(repo, memctx, path)
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
586
59
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 58
diff changeset
587 if '' in files_touched:
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 58
diff changeset
588 files_touched.remove('')
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
589 excluded = [f for f in files_touched if f not in hg_editor.meta.filemap]
188
f48cd62a9de4 fetch_command: fix coding style
Patrick Mezard <pmezard@gmail.com>
parents: 187
diff changeset
590 for f in excluded:
f48cd62a9de4 fetch_command: fix coding style
Patrick Mezard <pmezard@gmail.com>
parents: 187
diff changeset
591 files_touched.remove(f)
401
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
592
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
593 if parentctx.node() == node.nullid and not files_touched:
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
594 continue
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
595
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
596 for f in files_touched:
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
597 if f:
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
598 # this is a case that really shouldn't ever happen, it means
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
599 # something is very wrong
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
600 assert f[0] != '/'
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
601
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
602 extra = util.build_extra(r.revnum, b, svn.uuid, svn.subdir)
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
603 if not hg_editor.meta.usebranchnames:
401
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
604 extra.pop('branch', None)
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
605
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
606 current_ctx = context.memctx(hg_editor.repo,
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
607 [parentctx.node(), revlog.nullid],
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
608 r.message or util.default_commit_msg,
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
609 files_touched,
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
610 filectxfn,
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
611 hg_editor.meta.authors[r.author],
401
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
612 date,
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
613 extra)
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
614 ha = hg_editor.repo.commitctx(current_ctx)
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
615
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
616 branch = extra.get('branch', None)
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
617 if not branch in hg_editor.meta.branches:
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
618 hg_editor.meta.branches[branch] = None, 0, r.revnum
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
619 hg_editor.meta.revmap[r.revnum, b] = ha
401
9e87f7047bf1 stupid: simplify stupid committing code
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 377
diff changeset
620 util.describe_commit(ui, ha, b)
373
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
621
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
622 # These are branches with an 'R' status in svn log. This means they were
147
22162380c4b9 Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents: 141
diff changeset
623 # replaced by some other branch, so we need to verify they get marked as closed.
22162380c4b9 Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents: 141
diff changeset
624 for branch in check_deleted_branches:
373
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
625 closed = checkbranch(hg_editor, r, branch)
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
626 if closed is not None:
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
627 deleted_branches[branch] = closed
8c91e6a69d05 Get rid of duplicate branch closing detection code for stupid mode.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 368
diff changeset
628
376
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
629 if tbdelta['tags'][0] or tbdelta['tags'][1]:
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
630 hg_editor.meta.committags(tbdelta['tags'], r, deleted_branches)
376
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
631
133
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 129
diff changeset
632 for b, parent in deleted_branches.iteritems():
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 129
diff changeset
633 if parent == node.nullid:
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 129
diff changeset
634 continue
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
635 hg_editor.meta.delbranch(b, parent, r)
367
ce64d57172a3 Generate separate data structure containing revision's tags/branches changes.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 366
diff changeset
636
ce64d57172a3 Generate separate data structure containing revision's tags/branches changes.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 366
diff changeset
637 # save the changed metadata
414
343da842dbe6 split parts of HgChangeReceiver out into an SVNMeta class
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 412
diff changeset
638 hg_editor.meta._save_metadata()