monotone-commits-diffs
[Top][All Lists]
Advanced

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

[Monotone-commits-diffs] net.venge.monotone.issue-120: 38220f6ec36f96e7


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.issue-120: 38220f6ec36f96e77eea6f8eb31d729fb4c35b97
Date: Thu, 24 Feb 2011 17:30:37 +0100 (CET)

revision:            38220f6ec36f96e77eea6f8eb31d729fb4c35b97
date:                2011-02-23T10:23:57
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone.issue-120
changelog:
propagate from branch 'net.venge.monotone' (head 
9fa8e839780984c1028b5023f47d525066d99535)
            to branch 'net.venge.monotone.issue-120' (head 
d7372b630bc6b89e6ce810652cb2dd011f06297e)

manifest:
format_version "1"

new_manifest [acc1bba75611c1d13e559470862054ce5093be0f]

old_revision [9fa8e839780984c1028b5023f47d525066d99535]

patch "NEWS"
 from [848a8d23c760b709d5954ef1ca4a812c72404343]
   to [10e25e4e76b43b8ee758a8e3d8c3ed27087af2a3]

patch "src/cmd_list.cc"
 from [eede6b49bfe267b8e9b361c12bbcc26f53e86191]
   to [52eb368ccb13dc0ec9dd6095ff92993a5d3f28cf]

old_revision [d7372b630bc6b89e6ce810652cb2dd011f06297e]

add_file "extra/bin/mtn-cleanup.1"
 content [b898678b0775bf10a7428cfd8b52a4883edddbcc]

add_file "src/util/mtnopt.1"
 content [8e24a1cafa100a7d6681cc19e30ee82a4cf517f4]

patch "Makefile.am"
 from [76876b1be2336cc1f70ad906309e148e5d67ff7d]
   to [6e6a3f7aaecccc749e261d452d84bd8431ba6cb7]

patch "contrib/monotone-cluster-push.lua"
 from [2ee0e849058ea7bbef9487fc21772d1fb66500d6]
   to [3a4f3bd0394d70d5c07c9314ad42026b212a4983]

patch "extra/shell/monotone.bash_completion.in"
 from [f7d35f2c13c6babc009800a11f6eff1eb69b01d9]
   to [a878e6fa815f84f18961fb2366d0235376be8c29]

patch "src/cmd_list.cc"
 from [042cb24c88d1bbfd70cc57b5f054b5d51adb3de3]
   to [52eb368ccb13dc0ec9dd6095ff92993a5d3f28cf]

patch "src/database.cc"
 from [8966518247a144a25de01b4ab8fa9e515661edfb]
   to [f61bd0d7d66a715c7a55cb943eb8521db6d91d68]
============================================================
--- NEWS	848a8d23c760b709d5954ef1ca4a812c72404343
+++ NEWS	10e25e4e76b43b8ee758a8e3d8c3ed27087af2a3
@@ -118,6 +118,9 @@ XXX XXX XX XX:XX:XX UTC 2011
           or partial identifier contains non-hex digits.
           (fixes monotone issue 143)
 
+        - Performance of "mtn ls changed" has been improved and is now
+          comparable to "mtn status". (fixes monotone issue 120)
+
         Internal
 
         - The source tree has been reorganized. Sources, tests and documentation
============================================================
--- src/cmd_list.cc	eede6b49bfe267b8e9b361c12bbcc26f53e86191
+++ src/cmd_list.cc	52eb368ccb13dc0ec9dd6095ff92993a5d3f28cf
@@ -12,6 +12,8 @@
 #include "safe_map.hh"
 #include <utility>
 #include <iostream>
+#include <sstream>
+#include <set>
 #include <iterator>
 
 #include <boost/tuple/tuple.hpp>
@@ -45,6 +47,7 @@ using std::ostream;
 using std::sort;
 using std::copy;
 using std::ostream;
+using std::ostringstream;
 using std::string;
 using std::vector;
 
@@ -853,50 +856,97 @@ CMD(changed, "changed", "", CMD_REF(list
     "",
     options::opts::depth | options::opts::exclude)
 {
+  roster_t new_roster;
+  parent_map old_rosters;
+  revision_t rev;
+  temp_node_id_source nis;
+
   database db(app);
+  project_t project(db);
   workspace work(app);
 
-  parent_map parents;
-  roster_t new_roster;
-  temp_node_id_source nis;
+  work.get_parent_rosters(db, old_rosters);
   work.get_current_roster_shape(db, nis, new_roster);
-  work.update_current_roster_from_filesystem(new_roster);
 
-  work.get_parent_rosters(db, parents);
-
   node_restriction mask(args_to_paths(args),
                         args_to_paths(app.opts.exclude),
                         app.opts.depth,
-                        parents, new_roster, ignored_file(work));
+                        old_rosters, new_roster, ignored_file(work));
 
-  revision_t rrev;
-  make_restricted_revision(parents, new_roster, mask, rrev);
+  work.update_current_roster_from_filesystem(new_roster, mask);
+  make_restricted_revision(old_rosters, new_roster, mask, rev);
 
-  // to be printed sorted, with duplicates removed
-  set<file_path> print_paths;
+  revision_id rid;
+  calculate_ident(rev, rid);
 
-  for (edge_map::const_iterator i = rrev.edges.begin();
-       i != rrev.edges.end(); i++)
+  set<file_path> output_files;
+
+  // TODO: Refactor this method and promote these locals to parameters
+  // We can then use the method to provide us with "mtn ls added" for
+  // example
+  bool output_dropped = true;
+  bool output_renamed = true;
+  bool output_added = true;
+  bool output_patched = true;
+  bool output_attrs = true;
+
+  for (edge_map::const_iterator i = rev.edges.begin(); i != rev.edges.end(); ++i)
     {
-      set<node_id> nodes;
-      roster_t const & old_roster
-        = *safe_get(parents, edge_old_revision(i)).first;
-      select_nodes_modified_by_cset(edge_changes(i),
-                                    old_roster, new_roster, nodes);
+      revision_id parent = edge_old_revision(*i);
+      cset const & cs = edge_changes(*i);
 
-      for (set<node_id>::const_iterator i = nodes.begin(); i != nodes.end();
-           ++i)
+      if (output_dropped)
         {
-          file_path p;
-          if (new_roster.has_node(*i))
-            new_roster.get_name(*i, p);
-          else
-            old_roster.get_name(*i, p);
-          print_paths.insert(p);
+          for (set<file_path>::const_iterator i = cs.nodes_deleted.begin();
+            i != cs.nodes_deleted.end(); ++i)
+            output_files.insert(*i);
         }
+
+      if (output_renamed)
+        {
+          for (map<file_path, file_path>::const_iterator
+            i = cs.nodes_renamed.begin();
+            i != cs.nodes_renamed.end(); ++i)
+            output_files.insert(i->second);
+        }
+
+      if (output_added)
+        {
+          for (set<file_path>::const_iterator i = cs.dirs_added.begin();
+            i != cs.dirs_added.end(); ++i)
+            output_files.insert(*i);
+
+          for (map<file_path, file_id>::const_iterator i = cs.files_added.begin();
+            i != cs.files_added.end(); ++i)
+            output_files.insert(i->first);
+        }
+
+      if (output_patched)
+        {
+          for (map<file_path, pair<file_id, file_id> >::const_iterator
+            i = cs.deltas_applied.begin(); i != cs.deltas_applied.end(); ++i)
+            output_files.insert(i->first);
+        }
+
+      if (output_attrs)
+        {
+          for (map<pair<file_path, attr_key>, attr_value >::const_iterator
+            i = cs.attrs_set.begin(); i != cs.attrs_set.end(); ++i)
+            output_files.insert(i->first.first);
+
+            // FIXME: naming here could not be more inconsistent
+            // the cset calls it attrs_cleared
+            // the command is attr drop
+            // here it is called unset
+            // the revision text uses attr clear 
+
+          for (set<pair<file_path, attr_key> >::const_iterator
+            i = cs.attrs_cleared.begin(); i != cs.attrs_cleared.end(); ++i)
+            output_files.insert(i->first);
+        }
     }
 
-  copy(print_paths.begin(), print_paths.end(),
+  copy(output_files.begin(), output_files.end(),
        ostream_iterator<file_path>(cout, "\n"));
 }
 
============================================================
--- Makefile.am	76876b1be2336cc1f70ad906309e148e5d67ff7d
+++ Makefile.am	6e6a3f7aaecccc749e261d452d84bd8431ba6cb7
@@ -249,14 +249,23 @@ mtnhooksdir = $(monotonedir)/hooks
 monotonedir = $(datadir)/monotone
 
 mtnhooksdir = $(monotonedir)/hooks
-mtnhooks_DATA = \
+dist_mtnhooks_DATA = \
 	extra/mtn-hooks/authorize_remote_automate.lua			\
 	extra/mtn-hooks/get_passphrase_from_file.lua			\
+	extra/mtn-hooks/monotone-ciabot.lua				\
 	extra/mtn-hooks/monotone-mail-notify.lua
 
 mtnscriptsdir = $(monotonedir)/scripts
-dist_mtnscripts_SCRIPTS = extra/mtn-hooks/monotone-mail-notify
+dist_mtnscripts_SCRIPTS = \
+	extra/mtn-hooks/monotone-ciabot.py				\
+	extra/mtn-hooks/monotone-mail-notify
 
+# Some of the smaller programs do not have --help or --version,
+# make them exempt of the check for those.  NOTE: use this sparingly!
+AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = \
+	extra/bin/mtn-cleanup 	extra/mtn-hooks/monotone-ciabot.py	\
+	extra/mtn-hooks/monotone-mail-notify
+
 # flags
 
 # sets DEFS for just this object (autoconf's -DHAVE_CONFIG_H is useless)
@@ -348,8 +357,7 @@ EXTRA_DIST =								\
 	HACKING INSTALL INSTALL_windows_cygwin.txt			\
 	INSTALL_windows_native.txt README.visualc8 UPGRADE		\
 	util/audit-includes util/do-editor-vars.sh			\
-	$(wildcard $(srcdir)/m4/*.m4) doc/monotone.html doc/images	\
-	doc/texinfo.css src/schema.sql src/unix/README			\
+	$(wildcard $(srcdir)/m4/*.m4) src/schema.sql src/unix/README	\
 	src/util/mtnopt.in innosetup/README.txt				\
 	innosetup/monotone.iss.in innosetup/modpath.iss 		\
 	innosetup/monotone.bmp innosetup/dlls.sh			\
@@ -367,7 +375,11 @@ EXTRA_DIST =								\
 									\
 	src/package_revision.txt src/package_full_revision_dist.txt	\
 									\
-	mac notes visualc $(contrib_data) $(examples_data) extra
+	mac notes visualc $(contrib_data) $(examples_data)		\
+									\
+	extra/README extra/building/dump-test-logs.sh.in		\
+	extra/shell/monotone.bash_completion.in				\
+	extra/shell/monotone_gen_bash_completion_table.pl
 
 # Message translation support
 # INST_LINGUAS is set by configure, based on the po/LINGUAS file and
@@ -462,12 +474,6 @@ dist-nls: $(ALL_GMOFILES)
 
 dist-nls: $(ALL_GMOFILES)
 	cp $(ALL_GMOFILES) $(distdir)/po
-# also, kill off any backup files that got pulled in by one of the
-# recursive subdirectory includes in EXTRA_DIST
-# note use of slightly non-portable "-delete" action
-	find $(distdir) \( -name '*.bak' -o -name '*.orig' -o -name '*.rej' \
-	    -o -name '*~' -o -name '#*#' -o -name '*.swp' \) -delete
-
 else
 
 po/%.gmo: $(srcdir)/po/%.gmo
@@ -693,7 +699,8 @@ BUILT_SOURCES = $(PCH_FILE) $(PCH_BUILD)
 
 BUILT_SOURCES = $(PCH_FILE) $(PCH_BUILD)
 
-CLEANFILES = $(bin_SCRIPTS) $(bashcomp_DATA) $(BUILT_SOURCES) $(CLEAN_SRCS) $(CLEAN_POFILES)
+CLEANFILES = $(bin_SCRIPTS) $(noinst_SCRIPTS) $(bashcomp_DATA) \
+	$(BUILT_SOURCES) $(CLEAN_SRCS) $(CLEAN_POFILES)
 
 # automake provides no nice way to build a helper program to execute
 # on the build machine, so we need our own rule.  almost all the
@@ -722,11 +729,12 @@ do_subst = sed -e 's,address@hidden
 do_subst = sed -e 's,address@hidden@],$(PACKAGE_VERSION),' \
 	-e 's,address@hidden@],$(sysconfdir),'
 
-%: src/util/%.in Makefile
+mtnopt: src/util/mtnopt.in Makefile
 	$(V_subst)$(do_subst) < $< > $@ && chmod +x $@
 
 extra/shell/monotone.bash_completion: extra/shell/monotone.bash_completion.in \
-	$(bin_PROGRAMS) extra/shell/monotone_gen_bash_completion_table.pl
+	$(bin_PROGRAMS) extra/shell/monotone_gen_bash_completion_table.pl \
+	Makefile
 	$(MKDIR_P) extra/shell
 	( sed -e '/address@hidden@]$$/,$$d' < $<; \
 	  MTN=./mtn$(EXEEXT) \
@@ -826,6 +834,7 @@ man1_MANS = mtn.1
                        src/win32/main.cc src/unix/main.cc)
 
 man1_MANS = mtn.1
+dist_man1_MANS = src/util/mtnopt.1 extra/bin/mtn-cleanup.1
 
 # All local variants of automake-supported targets here, depending on all
 # the things we want to do.  This is to support multiple things to do in
@@ -837,11 +846,17 @@ check-local: check-testers
 	uninstall-contrib-data uninstall-examples-data
 mostlyclean-local: mostlyclean-tests
 check-local: check-testers
+
 # All hooks supported by automake here, depending on all the things we want
 # to hook in.  This is to support multiple things into the same hook, as
 # dependencies.
+distcheck-hook: distcheck-base.hh
 dist-hook: dist-nls
-distcheck-hook: distcheck-base.hh
+# Kill off any backup files that got pulled in by one of the
+# recursive subdirectory includes in EXTRA_DIST
+# note use of slightly non-portable "-delete" action
+	find $(distdir) \( -name '*.bak' -o -name '*.orig' -o -name '*.rej' \
+	    -o -name '*~' -o -name '#*#' -o -name '*.swp' \) -delete
 
 mtn.1: mtn$(EXEEXT)
 	$(AM_V_GEN)REAL_BLDDIR=$$PWD/$(top_builddir); \
============================================================
--- src/database.cc	8966518247a144a25de01b4ab8fa9e515661edfb
+++ src/database.cc	f61bd0d7d66a715c7a55cb943eb8521db6d91d68
@@ -4974,7 +4974,7 @@ database_path_helper::get_database_path(
   vector<system_path> search_paths;
 
   E(lua.hook_get_default_database_locations(search_paths) && search_paths.size() > 0,
-    origin::user, F("could not query default database locations"));
+    origin::user, F("no default database location configured"));
 
   for (vector<system_path>::const_iterator i = search_paths.begin();
      i != search_paths.end(); ++i)
============================================================
--- src/cmd_list.cc	042cb24c88d1bbfd70cc57b5f054b5d51adb3de3
+++ src/cmd_list.cc	52eb368ccb13dc0ec9dd6095ff92993a5d3f28cf
@@ -684,7 +684,7 @@ CMD(databases, "databases", "dbs", CMD_R
   vector<system_path> search_paths, files, dirs;
 
   E(app.lua.hook_get_default_database_locations(search_paths), origin::user,
-    F("could not query default database locations"));
+    F("no default database location configured"));
 
   globish file_matcher;
   E(app.lua.hook_get_default_database_glob(file_matcher), origin::user,
@@ -739,8 +739,8 @@ CMD(databases, "databases", "dbs", CMD_R
               continue;
             }
 
-            cout << F("%s (in %s):") % db_alias % search_path << "\n";
-            print_workspace_info(db, app.lua, cout, "\t");
+          cout << F("%s (in %s):") % db_alias % search_path << "\n";
+          print_workspace_info(db, app.lua, cout, "\t");
         }
     }
 }
============================================================
--- contrib/monotone-cluster-push.lua	2ee0e849058ea7bbef9487fc21772d1fb66500d6
+++ contrib/monotone-cluster-push.lua	3a4f3bd0394d70d5c07c9314ad42026b212a4983
@@ -210,7 +210,7 @@ do
 	    end
 	    if certs_in > 0 or revs_in > 0 or keys_in > 0 then
 	       local pattern_branches =
-		  process_rcfile("not_netsync_end", MCP_rcfile, nil)
+		  process_rcfile("note_netsync_end", MCP_rcfile, nil)
 	       if pattern_branches then
 		  for pattern, servers in pairs(pattern_branches) do
 		     if globish_match(pattern, branch) then
@@ -222,7 +222,7 @@ do
 			   io.stderr:write("note_netsync_end: ",
 					   "pushing pattern \"", pattern,
 					   "\" to server ", server, "\n")
-			   server_request_sync("push", server, pattern, "")
+			   server_request_sync("push", server.."?"..pattern, "")
 			end
 		     end
 		  end
@@ -232,7 +232,5 @@ do
 	 end
    }
 
-   local saved_note_mtn_startup = note_mtn_startup
-
    push_netsync_notifier(notifier)
 end
============================================================
--- extra/shell/monotone.bash_completion.in	f7d35f2c13c6babc009800a11f6eff1eb69b01d9
+++ extra/shell/monotone.bash_completion.in	a878e6fa815f84f18961fb2366d0235376be8c29
@@ -281,9 +281,10 @@ _monotone() {
 		elif [ $arg_cword -ge 0 ]; then
 		    local args=( ${_monotone_command_args[$cmd_line]} )
 		    local argtype=${args[$arg_cword]}
-		    if [ "$argtype" = "..." ]; then
+		    if [ $arg_cword -ge 1 ] && [ "$argtype" = "..." ]; then
 			argtype=${args[$arg_cword-1]}
-		    elif [ -z "$argtype" -a "${args[${#args[*]}-1]}" = "..." ]; then
+		    elif [ ${#args[*]} -ge 2 ] && \
+			[ -z "$argtype" -a "${args[${#args[*]}-1]}" = "..." ]; then
 			argtype=${args[${#args[*]}-2]}
 		    fi
 		    case $argtype in
============================================================
--- /dev/null	
+++ extra/bin/mtn-cleanup.1	b898678b0775bf10a7428cfd8b52a4883edddbcc
@@ -0,0 +1,22 @@
+.TH "MTN-CLEANUP" 1 2011-02-22 monotone monotone
+.SH "NAME"
+mtn-cleanup \- generate shell variables from monotone workspace options
+.SH "SYNOPSIS"
+.B mtn-cleanup
+.br
+.SH "DESCRIPTION"
+.B mtn-cleanup
+returns a workspace to its pristine state with the minimum of change;
+missing files are restored, changed files are reverted and new files
+are removed.
+.SH "BUGS"
+.B mtn-cleanup
+doesn't look to see if the database happens to be somewhere in the
+workspace, and might therefore remove it.  Future version may take a
+look at
+.I _MTN/options
+to check for this possibility.
+.SH "SEE ALSO"
+.BR mtn (1),
+.SH "AUTHOR"
+Written by Anthony Edward Cooper <address@hidden>.
============================================================
--- /dev/null	
+++ src/util/mtnopt.1	8e24a1cafa100a7d6681cc19e30ee82a4cf517f4
@@ -0,0 +1,95 @@
+.TH MTNOPT 1 2011-02-22 monotone monotone
+.SH NAME
+mtnopt \- generate shell variables from monotone workspace options
+.SH SYNOPSIS
+.B mtnopt
+.RB [\| \-s \||\| \-c \||\| \-v \|]
+.RB [\| \-d 
+.IR dir \|]
+.RB [\| \-k
+.IR keys \|]
+.br
+.B mtnopt -h
+.br
+.SH DESCRIPTION
+.B mtnopt
+prints shell variable assignments for each value in the file of
+monotone workspace options,
+.IR _MTN/options ,
+in the current directory. For instance, if
+.I _MTN/options
+contained this text:
+.IP
+\f(CWdatabase "/home/user/src/monotone.mtn"\fP
+.br
+\f(CW  branch "net.venge.monotone"\fP
+.br
+\f(CW  keydir "/home/user/.monotone/keys"\fP
+.PP
+.B mtnopt
+would print:
+.IP
+\f(CWMTN_database="/home/user/src/monotone.mtn";\fP
+.br
+\f(CWMTN_branch="net.venge.monotone";\fP
+.br
+\f(CWMTN_keydir="/home/user/.monotone/keys";\fP
+.PP
+By default,
+.B mtnopt 
+attempts to guess appropriate syntax from the value of the
+.B SHELL
+environment variable.  This can be overridden with the 
+.B \-s
+and 
+.B \-c
+command\(hyline options.
+.SH OPTIONS
+.TP
+.B \-s
+Print variable assignments in 
+.BR sh (1)
+syntax.
+.TP
+.B \-c
+Print variable assignments in 
+.BR csh (1)
+syntax.
+.TP
+.B \-v
+Print only the values, with no indication of the corresponding option keys.
+.TP
+.BI \-d\  directory
+Look for 
+.I _MTN/options
+in
+.IR directory ,
+rather than in the current directory.
+.TP
+.BI \-k\  keys
+Print assignments for only those options that match the
+.BR egrep (1)
+regular _expression_
+.IR keys .
+.TP
+.B \-h
+Print a help message and exit.
+.SH BUGS
+.B mtnopt
+only looks in the current directory for the
+.I _MTN
+directory, so it will fail in a subdirectory of a workspace.
+.PP
+.B mtnopt
+should be aware of the set of possible options, rather than blindly
+printing whatever is in
+.IR _MTN/options .
+.PP
+The behavior when there is no
+.I _MTN/options
+file to be found is less than helpful.
+.SH SEE ALSO
+.BR mtn (1),
+.BR egrep (1),
+.BR sh (1),
+.BR csh (1)

reply via email to

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