174 |
173 |
175 This command lets you dump a repository as a human-readable text stream. |
174 This command lets you dump a repository as a human-readable text stream. |
176 It can be piped into corresponding import routines like "git fast-import". |
175 It can be piped into corresponding import routines like "git fast-import". |
177 Incremental dumps can be created by using marks files. |
176 Incremental dumps can be created by using marks files. |
178 """ |
177 """ |
179 opts = pycompat.byteskwargs(opts) |
178 revs += tuple(opts.get("rev", [])) |
180 |
|
181 revs += tuple(opts.get(b"rev", [])) |
|
182 if not revs: |
179 if not revs: |
183 revs = scmutil.revrange(repo, [b":"]) |
180 revs = scmutil.revrange(repo, [b":"]) |
184 else: |
181 else: |
185 revs = logcmdutil.revrange(repo, revs) |
182 revs = logcmdutil.revrange(repo, revs) |
186 if not revs: |
183 if not revs: |
187 raise error.Abort(_(b"no revisions matched")) |
184 raise error.Abort(_(b"no revisions matched")) |
188 authorfile = opts.get(b"authormap") |
185 authorfile = opts.get("authormap") |
189 if authorfile: |
186 if authorfile: |
190 authormap = convcmd.readauthormap(ui, authorfile) |
187 authormap = convcmd.readauthormap(ui, authorfile) |
191 else: |
188 else: |
192 authormap = {} |
189 authormap = {} |
193 |
190 |
194 import_marks = opts.get(b"import_marks") |
191 import_marks = opts.get("import_marks") |
195 marks = {} |
192 marks = {} |
196 if import_marks: |
193 if import_marks: |
197 with open(import_marks, "rb") as import_marks_file: |
194 with open(import_marks, "rb") as import_marks_file: |
198 for line in import_marks_file: |
195 for line in import_marks_file: |
199 line = line.strip() |
196 line = line.strip() |
207 ) as progress: |
204 ) as progress: |
208 for rev in revs: |
205 for rev in revs: |
209 export_commit(ui, repo, rev, marks, authormap) |
206 export_commit(ui, repo, rev, marks, authormap) |
210 progress.increment() |
207 progress.increment() |
211 |
208 |
212 export_marks = opts.get(b"export_marks") |
209 export_marks = opts.get("export_marks") |
213 if export_marks: |
210 if export_marks: |
214 with open(export_marks, "wb") as export_marks_file: |
211 with open(export_marks, "wb") as export_marks_file: |
215 output_marks = [None] * len(marks) |
212 output_marks = [None] * len(marks) |
216 for k, v in marks.items(): |
213 for k, v in marks.items(): |
217 output_marks[v - 1] = k |
214 output_marks[v - 1] = k |