[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] sync defaults

From: Stephen Leake
Subject: [Monotone-devel] sync defaults
Date: Sun, 16 Mar 2008 19:46:44 -0400
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1 (windows-nt)

I'm proposing the following patch to

# old_revision [b48784545a83782ceee86899dc28b5ca17b42fbe]
# patch ""
#  from [3fc803802fa21cc1e8e35faa705c749fa284c841]
#    to [a4cc78ff8b6ca44b17c1f1e6514a5e1e9984f598]
---      3fc803802fa21cc1e8e35faa705c749fa284c841
+++      a4cc78ff8b6ca44b17c1f1e6514a5e1e9984f598
@@ -223,11 +223,18 @@ CMD(sync, "sync", "", CMD_REF(network),
   extract_address(app.opts, db, args, addr);
   extract_patterns(app.opts, db, args, include_pattern, exclude_pattern);
   find_key_if_needed(app.opts, app.lua, db, keys,
-                     addr, include_pattern, exclude_pattern, false);
+                     addr, include_pattern, exclude_pattern, true);
   std::list<utf8> uris;
+  if (app.opts.set_default && workspace::found)
+    {
+      // Write workspace options, including key; this is the simplest way to
+      // fix a "found multiple keys" error reported by sync.
+      workspace work(app, true);
+    }
   run_netsync_protocol(app.opts, app.lua, project, keys,
                        client_voice, source_and_sink_role, uris,
                        include_pattern, exclude_pattern);

The first change (passing 'true' to find_key_if_needed) requires a key
(needed for writing to the server database); that means it will look
in _MTN/options if present. That was the behavior in mtn 0.39, and is
the same as 'mtn push'. 'mtn pull' sets this to false, since it can
work anonymously.

The second change writes the workspace options if --set-default is
specified and a workspace is present. That allows fixing an error
reported by sync when there are multiple keys in the keydir.

Hmm. 'push' should also write the 

Most commands write the workspace options even without --set-default,
but it seems appropriate to require that for sync.

The current help for '--set-default' says:

  --set-default        use the current arguments as the future default

I initially interpreted that to mean "arguments and options", and
wondered why it wasn't writing 'key' to _MTN/options. This change
makes it mean that.

Any objections?

-- Stephe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]