1141 # it is given two arguments (sequencenumber, changectx) |
1141 # it is given two arguments (sequencenumber, changectx) |
1142 extraexportmap = {} |
1142 extraexportmap = {} |
1143 |
1143 |
1144 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, |
1144 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, |
1145 opts=None, match=None): |
1145 opts=None, match=None): |
1146 '''export changesets as hg patches.''' |
1146 '''export changesets as hg patches |
|
1147 |
|
1148 Args: |
|
1149 repo: The repository from which we're exporting revisions. |
|
1150 revs: A list of revisions to export as revision numbers. |
|
1151 template: An optional string to use for generating patch file names. |
|
1152 fp: An optional file-like object to which patches should be written. |
|
1153 switch_parent: If True, show diffs against second parent when not nullid. |
|
1154 Default is false, which always shows diff against p1. |
|
1155 opts: diff options to use for generating the patch. |
|
1156 match: If specified, only export changes to files matching this matcher. |
|
1157 |
|
1158 Returns: |
|
1159 Nothing. |
|
1160 |
|
1161 Side Effect: |
|
1162 "HG Changeset Patch" data is emitted to one of the following |
|
1163 destinations: |
|
1164 fp is specified: All revs are written to the specified |
|
1165 file-like object. |
|
1166 template specified: Each rev is written to a unique file named using |
|
1167 the given template. |
|
1168 Neither fp nor template specified: All revs written to repo.ui.write() |
|
1169 ''' |
1147 |
1170 |
1148 total = len(revs) |
1171 total = len(revs) |
1149 revwidth = max([len(str(rev)) for rev in revs]) |
1172 revwidth = max([len(str(rev)) for rev in revs]) |
1150 filemode = {} |
1173 filemode = {} |
1151 |
1174 |