Setting a bk parent says "Add"

When I do this to make a parent unidirectional:

$ bk parent -i $(bk parent -l)
Add pull parent...

I always get disturbed by the word “Add”. Every time, I check the output of “bk parent” after, to see that it has done what I wanted. How hard would it be to fix? Not hard - this seems to work for my noddy example:

--- 1.65/src/parent.c	2016-02-25 14:20:36 -08:00
+++ edited/src/parent.c	2021-06-04 10:31:42 -07:00
@@ -21,7 +21,7 @@ PUSH_PARENT
 #define	PUSH_PARENT	"BitKeeper/log/push-parent"
 #define	PULL_PARENT	"BitKeeper/log/pull-parent"
 
-private	void	add(char *which, char *url, int *rc);
+private	void	add(const char* op, char *which, char *url, int *rc);
 private	void	rm(char *which, char *url, int *rc);
 private	char	**readf(char *file);
 private	int	record(void);
@@ -198,7 +198,7 @@ parent_main
 	/* set/add */
 	unless (av[optind]) usage();
 	while (av[optind]) {
-		add(which, av[optind], &rc);
+		add(opts.set ? "Set" : "Add", which, av[optind], &rc);
 		optind++;
 	}
 	unless (rc) rc = record();
@@ -257,7 +257,7 @@ print
 }
 
 private void
-add(char *which, char *url, int *rc)
+add(const char* op, char *which, char *url, int *rc)
 {
 	char	*p, *m;
 	char	*parent = "?";
@@ -275,7 +275,7 @@ add
 	}
 	unless (p = mdbm_fetch_str(opts.parents, url)) {
 		mdbm_store_str(opts.parents, url, which, MDBM_INSERT);
-		m = aprintf("Add %s %s\n", parent, url);
+		m = aprintf("%s %s %s\n", op, parent, url);
 		opts.mods = addLine(opts.mods, m);
 		free(url);
 		return;

Seems reasonable to me. I would leave add() signature alone and directly use opts.set in add(), as opts.parents is already used. And alter the other 3 printfs. And add some tests to t/t.parent. To answer your question, it’s harder than a quick fix, but not too bad. Some of the harder work is from newer gcc breaking the L() macro (but still compiling), so it would mean finishing out that change.