##// END OF EJS Templates
fastexport: migrate `opts` to native kwargs
Matt Harbison -
r51768:00081fa5 default
parent child Browse files
Show More
@@ -15,7 +15,6 b' from mercurial.utils import stringutil'
15 from mercurial import (
15 from mercurial import (
16 error,
16 error,
17 logcmdutil,
17 logcmdutil,
18 pycompat,
19 registrar,
18 registrar,
20 scmutil,
19 scmutil,
21 )
20 )
@@ -176,22 +175,20 b' def fastexport(ui, repo, *revs, **opts):'
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:
@@ -209,7 +206,7 b' def fastexport(ui, repo, *revs, **opts):'
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)
General Comments 0
You need to be logged in to leave comments. Login now