Subject: bug#6513: vc-mtn broken with monotone 0.48 (can't even open files)

From: Julio Merino <[email-masked]>
Date: Sun, 5 Sep 2010 13:02:36 +0100

On Sep 4, 2010, at 8:00 PM, Chong Yidong wrote:

> Julio Merino <[email-masked]> writes:
> 
>>> Do you want to take a stab at it?
>>> Just need to modify the parser for the mtn command...
>> 
>> Sure, and I actually even tried.  But it's not as easy as changing
>> some regexps... my elisp knowledge tends to zero.  The thing is that
>> the automate interface is good for automatic interaction, but its
>> output is completely different to what the interactive interface
>> provides.  Hence, some of the assumptions currently in the code make
>> it a bit harder to adjust...
> 
> If you provide several precise examples of the monotone output, someone
> else could try.

OK, here they go.  I'm listing all the different calls to mtn that I found in vc-mtn, what they are being used for, and what they should be instead.

As I mentioned above, the code should be using "mtn automate" instead of the commands directly, because the output of the automate subcommands is designed to be parseable and to remain stable.

Hope this helps.

===> mtn status

This is currently used to determine:

1) The state of a file.
2) The state of a directory.
3) The current branch name.
4) The identifier of the parent revision.

Its output in 0.48 is something like:

---- begin ----
$ mtn status
----------------------------------------------------------------------
Revision: 74b28934c805d0f851ddf65b506b2b294b28bd1f
Parent:   fae253a2ecad09ee873d95fae7c53148708d5496
Author:   [email-masked]
Date:     09/05/10 12:41:28
Branch:   testing

Changes against parent fae253a2ecad09ee873d95fae7c53148708d5496

  dropped  dir2
  dropped  dir2/bar
  dropped  file2
  renamed  dir1
       to  dir3
  renamed  file1
       to  file3
  added    dir4
  added    dir4/baz
  added    file4
  patched  file0

---- end ----

1, 2 and 4 should be obtained using "mtn automate get_current_revision":

---- begin ----
$ mtn automate get_current_revision
format_version "1"

new_manifest [ebc50c8bd814864861acc5a3cbf8596e2f6424ca]

old_revision [fae253a2ecad09ee873d95fae7c53148708d5496]

delete "dir2"

delete "dir2/bar"

delete "file2"

rename "dir1"
    to "dir3"

rename "file1"
    to "file3"

add_dir "dir4"

add_file "dir4/baz"
 content [da39a3ee5e6b4b0d3255bfef95601890afd80709]

add_file "file4"
 content [da39a3ee5e6b4b0d3255bfef95601890afd80709]

patch "file0"
 from [da39a3ee5e6b4b0d3255bfef95601890afd80709]
   to [c2dfb20012cea6a8088917c6edea86db619000c8]
---- end ----

To get 3, aka the current branch name, one has to obtain the old_revision value from the output above and run "mtn automate certs" on it, to later get the value of the "branch" certificate:

---- begin ----
mtn automate certs fae253a2ecad09ee873d95fae7c53148708d5496
      key [6ea96157b01677a59e263d6b82337b781ce57370]
signature "ok"
     name "author"
    value "[email-masked]"
    trust "trusted"

      key [6ea96157b01677a59e263d6b82337b781ce57370]
signature "ok"
     name "branch"
    value "testing"
    trust "trusted"

      key [6ea96157b01677a59e263d6b82337b781ce57370]
signature "ok"
     name "changelog"
    value "Another.
"
    trust "trusted"

      key [6ea96157b01677a59e263d6b82337b781ce57370]
signature "ok"
     name "date"
    value "2010-09-05T09:08:42"
    trust "trusted"
---- end ----

===> mtn cat -r

Use "mtn -r <revision id> automate get_file_of <filename>" instead.

===> mtn list tags

Use "mtn automate tags":

---- begin ----
$ mtn automate tags
     tag "atf-0.1"
revision [b5177db1b525d850f0df932506cf6a0910eb1696]
  signer [6ea96157b01677a59e263d6b82337b781ce57370]
branches "org.NetBSD.atf.src"

     tag "atf-0.10"
revision [bab5e0f99e767de2e6650bf3c1aa7a7aad23a915]
  signer [6ea96157b01677a59e263d6b82337b781ce57370]
branches "org.NetBSD.atf.src"

     tag "atf-0.2"
revision [d448334ad6893ecd494228e8d5555272adcc5643]
  signer [6ea96157b01677a59e263d6b82337b781ce57370]
branches "org.NetBSD.atf.src"
[... more similar entries ...]
---- end ----

===> mtn list branches

Use "mtn automate branches":

---- begin ----
$ mtn automate branches
org.NetBSD.atf.htdocs
org.NetBSD.atf.src
org.NetBSD.atf.src.doc
org.NetBSD.atf.src.reorg
---- end ----

===> mtn add
===> mtn commit -m
===> mtn revert
===> mtn log
===> mtn diff
===> mtn annotate
===> mtn complete revision

Can't find how to do these with the automate interface, so they should remain as they are.