Mercurial > hg
comparison mercurial/debugcommands.py @ 48691:b4bc9c4f925d
debugbuilddag: add a flag to allow running it from a non-empty repository
Allow that by default seems "dangerous", but having a flag to make it possible
will be useful to help building some repository incrementally. The newly introduced support is basic, but already useful.
Differential Revision: https://phab.mercurial-scm.org/D12094
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 27 Jan 2022 15:22:04 +0100 |
parents | 12ac4401ff7d |
children | 6000f5b25c9b 020378f32d57 |
comparison
equal
deleted
inserted
replaced
48690:d55c4472bbb6 | 48691:b4bc9c4f925d |
---|---|
176 b'overwritten-file', | 176 b'overwritten-file', |
177 None, | 177 None, |
178 _(b'add single file all revs overwrite'), | 178 _(b'add single file all revs overwrite'), |
179 ), | 179 ), |
180 (b'n', b'new-file', None, _(b'add new file at each rev')), | 180 (b'n', b'new-file', None, _(b'add new file at each rev')), |
181 ( | |
182 b'', | |
183 b'from-existing', | |
184 None, | |
185 _(b'continue from a non-empty repository'), | |
186 ), | |
181 ], | 187 ], |
182 _(b'[OPTION]... [TEXT]'), | 188 _(b'[OPTION]... [TEXT]'), |
183 ) | 189 ) |
184 def debugbuilddag( | 190 def debugbuilddag( |
185 ui, | 191 ui, |
186 repo, | 192 repo, |
187 text=None, | 193 text=None, |
188 mergeable_file=False, | 194 mergeable_file=False, |
189 overwritten_file=False, | 195 overwritten_file=False, |
190 new_file=False, | 196 new_file=False, |
197 from_existing=False, | |
191 ): | 198 ): |
192 """builds a repo with a given DAG from scratch in the current empty repo | 199 """builds a repo with a given DAG from scratch in the current empty repo |
193 | 200 |
194 The description of the DAG is read from stdin if not given on the | 201 The description of the DAG is read from stdin if not given on the |
195 command line. | 202 command line. |
224 if text is None: | 231 if text is None: |
225 ui.status(_(b"reading DAG from stdin\n")) | 232 ui.status(_(b"reading DAG from stdin\n")) |
226 text = ui.fin.read() | 233 text = ui.fin.read() |
227 | 234 |
228 cl = repo.changelog | 235 cl = repo.changelog |
229 if len(cl) > 0: | 236 if len(cl) > 0 and not from_existing: |
230 raise error.Abort(_(b'repository is not empty')) | 237 raise error.Abort(_(b'repository is not empty')) |
231 | 238 |
232 # determine number of revs in DAG | 239 # determine number of revs in DAG |
233 total = 0 | 240 total = 0 |
234 for type, data in dagparser.parsedag(text): | 241 for type, data in dagparser.parsedag(text): |