diff mercurial/debugcommands.py @ 48705: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 020378f32d57 6000f5b25c9b
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Thu Jan 27 17:04:40 2022 +0100
+++ b/mercurial/debugcommands.py	Thu Jan 27 15:22:04 2022 +0100
@@ -178,6 +178,12 @@
             _(b'add single file all revs overwrite'),
         ),
         (b'n', b'new-file', None, _(b'add new file at each rev')),
+        (
+            b'',
+            b'from-existing',
+            None,
+            _(b'continue from a non-empty repository'),
+        ),
     ],
     _(b'[OPTION]... [TEXT]'),
 )
@@ -188,6 +194,7 @@
     mergeable_file=False,
     overwritten_file=False,
     new_file=False,
+    from_existing=False,
 ):
     """builds a repo with a given DAG from scratch in the current empty repo
 
@@ -226,7 +233,7 @@
         text = ui.fin.read()
 
     cl = repo.changelog
-    if len(cl) > 0:
+    if len(cl) > 0 and not from_existing:
         raise error.Abort(_(b'repository is not empty'))
 
     # determine number of revs in DAG