Fossil User Forum

--admin-user switch to `fossil import`
Login

--admin-user switch to `fossil import`

--admin-user switch to `fossil import`

(1) By Alfred M. Szmidt (ams) on 2020-02-19 07:56:29 [source]

Small patch to add -A/--admin-user flag to the `fossil import` command.  Found that I needed it, maybe someone else will find it use for it.

Index: src/import.c
==================================================================
--- src/import.c
+++ src/import.c
 **   --no-rebuild         skip the "rebuilding metadata" step
 **   --no-vacuum          skip the final VACUUM of the database file
 **   --rename-trunk NAME  use NAME as name of imported trunk branch
 **   --rename-branch PAT  rename all branch names using PAT pattern
 **   --rename-tag PAT     rename all tag names using PAT pattern
+**   --admin-user|-A USERNAME select given USERNAME as admin user
 **
 ** The --incremental option allows an existing repository to be extended
 ** with new content.  The --rename-* options may be useful to avoid name
 ** conflicts when using the --incremental option.
 **
@@ -1663,10 +1664,11 @@
   int forceFlag = find_option("force", "f", 0)!=0;
   int svnFlag = find_option("svn", 0, 0)!=0;
   int gitFlag = find_option("git", 0, 0)!=0;
   int omitRebuild = find_option("no-rebuild",0,0)!=0;
   int omitVacuum = find_option("no-vacuum",0,0)!=0;
+  const char *zDefaultUser = find_option("admin-user","A",1);
 
   /* Options common to all input formats */
   int incrFlag = find_option("incremental", "i", 0)!=0;
 
   /* Options for --svn only */
@@ -1759,11 +1761,11 @@
   db_open_repository(g.argv[2]);
   db_open_config(0, 0);
 
   db_begin_transaction();
   if( !incrFlag ){
-    db_initial_setup(0, 0, 0);
+    db_initial_setup(0, 0, zDefaultUser);
     db_set("main-branch", gimport.zTrunkName, 0);
   }
 
   if( svnFlag ){
     db_multi_exec(

(2) By Stephan Beal (stephan) on 2020-02-20 00:19:06 in reply to 1 [link] [source]

Small patch to add -A/--admin-user flag to the fossil import command.

Just FYI, this has been added to my todo list for early next week (almost certainly Monday).

(3) By Stephan Beal (stephan) on 2020-02-25 18:36:41 in reply to 1 [link] [source]

... add -A/--admin-user flag to the fossil import command

This flag has been added to a new branch:

https://fossil-scm.org/fossil/timeline?r=import-admin-user

i don't personally have a way to test it, so am looking for feedback on whether it actually does what it's documented as doing.

(4) By Alfred M. Szmidt (ams) on 2020-02-27 09:51:58 in reply to 3 [link] [source]

Thank you.

Works for me.  Using a random git repository, I did the following
(which isn't much different from what I did before):

$ git fast-export --all | fossil import -A ams --git ../test-import-admin.fossil
Rebuilding repository meta-data...
  100.0% complete...
Vacuuming... ok
project-id: 8...b
server-id:  8...6
admin-user: ams (password is "...")
$

And everything looks just fine.

(5) By Stephan Beal (stephan) on 2020-02-27 10:11:14 in reply to 4 [link] [source]

everything looks just fine.

That's a relief, because Richard already merged it into the trunk :).