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: d64b5a55c5543018


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

revision:            d64b5a55c55430187f13db7f5e7f4fc4dfd0649d
date:                2011-02-24T15:43:59
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone.issue-120
changelog:
propagate from branch 'net.venge.monotone' (head 
fc7f14c4e20b451cea25a056288efd4e1f9a11b7)
            to branch 'net.venge.monotone.issue-120' (head 
d5b9cddf866aa6605bec417040aa0f77047d82af)

manifest:
format_version "1"

new_manifest [f59b626bbcb223dccb1afa851b50e557c08f6563]

old_revision [d5b9cddf866aa6605bec417040aa0f77047d82af]

patch "Makefile.am"
 from [6e6a3f7aaecccc749e261d452d84bd8431ba6cb7]
   to [8dd83453a5567b7657c91a0e375433564c218402]

patch "doc/Makefile.am"
 from [88c2b91289880ea9c9ef32f08e224547287f8fd7]
   to [dcc8331723e96245ccf9788fef5c02946580031e]

patch "doc/monotone.texi"
 from [5c18cff828089e592f5f2d53c2d60793715a4a40]
   to [0e40017dfe8ba652e6af4585a2ac176c8bd12dcc]

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

patch "extra/shell/monotone_gen_bash_completion_table.pl"
 from [d9622d595d6e8dc1d66a5b91af5e4c967e364a9a]
   to [724f810ba4f531c872f33f966d1ff04c5adb03c7]

patch "po/sv.po"
 from [f3f16f8383155e49bf182deb6fd93ed68ce61ea7]
   to [40733217ce5e8271ca5d235b14094cd258f2171e]

patch "src/base.hh"
 from [8ee936d762b2115fbaa7e54dc25ee634490c5fc9]
   to [a8d19ce4d4aab1fcfbc2f868fd09779c3c0e3ffa]

old_revision [fc7f14c4e20b451cea25a056288efd4e1f9a11b7]

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

patch "src/cmd_diff_log.cc"
 from [94a354875b587d372e6d0898ab6fc8355ce29c21]
   to [4a61bfb4b9c1066fcc650b2bc634ce582729ebb1]

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

patch "src/cmd_ws_commit.cc"
 from [7b91a53d8eec4e78b062092f85c945bbaaefe23a]
   to [9a9d30688c6a62be6568758d004b5aa3a8c89ee5]

patch "src/rev_output.cc"
 from [a2c70b893b31296917d1a2b974faa1da46c13f1e]
   to [26d81fbb1a78bfa09ec43a5396c58e75b2a07d66]

patch "src/rev_output.hh"
 from [666dd3ed35e16d8b122b4932c2aad05a21a22e25]
   to [6d5263e826dac07b647fccca09062d3598384f3f]
============================================================
--- Makefile.am	6e6a3f7aaecccc749e261d452d84bd8431ba6cb7
+++ Makefile.am	8dd83453a5567b7657c91a0e375433564c218402
@@ -218,26 +218,26 @@ bin_PROGRAMS = mtn
 # primaries
 
 bin_PROGRAMS = mtn
+mtn_SOURCES = $(MOST_SOURCES) src/monotone.cc
+nodist_mtn_SOURCES = src/std_hooks.cc src/schema.cc
+
 noinst_PROGRAMS = util/txt2c
+util_txt2c_SOURCES = util/txt2c.cc
+
 EXTRA_PROGRAMS =
 
 bin_SCRIPTS = mtnopt
 dist_bin_SCRIPTS = extra/bin/mtn-cleanup
 noinst_SCRIPTS = extra/building/dump-test-logs.sh
 
-mtn_SOURCES = $(MOST_SOURCES) src/monotone.cc
-nodist_mtn_SOURCES = src/std_hooks.cc src/schema.cc
-
+check_PROGRAMS = test/bin/unit_tester test/bin/tester test/bin/check_net
 test_bin_unit_tester_SOURCES = $(UNIT_TESTERS) $(UNIT_TESTERS_PRIV) \
 	$(UNIT_TESTEES) $(UNIT_TEST_SUPPORT)
-
 test_bin_tester_SOURCES = test/src/tester.cc test/src/tester-plaf.hh src/transforms.cc src/gzip.cc \
 	$(SANITY_CORE_SOURCES) $(LUAEXT_SOURCES) src/pcrewrap.cc \
 	src/specialized_lexical_cast.cc
 nodist_test_bin_tester_SOURCES = test/src/testlib.cc
 
-util_txt2c_SOURCES = util/txt2c.cc
-
 noinst_LIBRARIES = src/libplatform.a src/lib3rdparty.a
 src_libplatform_a_SOURCES = src/platform.hh
 src_lib3rdparty_a_SOURCES = $(BOOST_SANDBOX_SOURCES) \
@@ -394,9 +394,9 @@ ALL_GMOFILES  := $(addprefix po/,$(addsu
 ALL_LINGUAS   := $(basename $(notdir $(ALL_POFILES)))
 ALL_POREADMES := $(addprefix po/README.,$(ALL_LINGUAS))
 ALL_GMOFILES  := $(addprefix po/,$(addsuffix .gmo, $(ALL_LINGUAS)))
-CLEAN_POFILES := $(ALL_GMOFILES) \
-		 $(addprefix po/,$(addsuffix .merged.po, $(ALL_LINGUAS))) \
+CLEAN_POFILES := $(addprefix po/,$(addsuffix .merged.po, $(ALL_LINGUAS))) \
 		 po/$(PACKAGE).pot
+MAINTAINERCLEAN_POFILES := $(ALL_GMOFILES)
 
 EXTRA_DIST += $(ALL_POFILES) $(ALL_POREADMES) po/LINGUAS po/README
 
@@ -653,12 +653,9 @@ test/func.status : mtn$(EXEEXT) test/bin
 
 # Creates the needed artifacts for manual test execution
 .PHONY: testers
-testers: mtn$(EXEEXT) test/bin/tester$(EXEEXT) test/bin/unit_tester$(EXEEXT) \
-	test/bin/check_net$(EXEEXT) \
+testers: mtn$(EXEEXT) $(check_PROGRAMS)
 	run_tester_tests run_func_tests run_unit_tests run_extra_tests
 
-check_PROGRAMS = test/bin/unit_tester test/bin/tester test/bin/check_net
-
 # We want the tests re-run even if the .status files already exist.
 # .PHONY does not work for that (bad interaction with pattern rules),
 # but the FORCE hack does.
@@ -671,8 +668,7 @@ mostlyclean-tests:
 #	 automake's man page
 .PHONY: mostlyclean-tests
 mostlyclean-tests:
-	rm -rf test/bin test/work
-	rm -f run_*_tests test/*.status test/src/testlib.cc util/txt2c
+	rm -rf test/work
 	@ls test/unit/tests/*/__driver__.lua 2>/dev/null | while read d; do \
 	  echo " rm -f '$$d'"; \
 	  rm -f $$d; \
@@ -680,9 +676,9 @@ mostlyclean-tests:
 	  rmdir $${d%/*} || :; \
 	done
 
-DISTCLEANFILES = src/mt-stdint.h src/xgettext.opts src/pch-build.hh.gch.dep	\
-	run_tester_tests run_unit_tests run_func_tests run_extra_tests		\
-	test/tester.status test/unit.status test/func.status test/extra.status
+MOSTLYCLEANFILES = mtn.1 \
+	run_tester_tests   run_func_tests   run_unit_tests   run_extra_tests \
+	test/tester.status test/func.status test/unit.status test/extra.status
 
 # we generate some source files to copy data into the executable
 # note that the only things that should go in BUILT_SRCS are things
@@ -691,17 +687,27 @@ DISTCLEANFILES = src/mt-stdint.h src/xge
 
 # package_revision.txt and package_full_revision_dist.txt are shipped
 # in the distribution, so don't delete them here
-CLEAN_SRCS = src/std_hooks.cc unit/src/testlib.cc src/schema.cc \
-	src/package_revision.cc src/package_full_revision.cc \
-	src/package_revision_raw.txt \
-	src/package_full_revision.txt src/package_full_revision_raw.txt \
-	mtn.1
+CLEAN_SRCS = $(nodist_mtn_SOURCES) $(nodist_test_bin_tester_SOURCES)	\
+	src/package_revision.cc src/package_full_revision.cc		\
+	src/package_revision_raw.txt					\
+	src/package_full_revision.txt src/package_full_revision_raw.txt
 
 BUILT_SOURCES = $(PCH_FILE) $(PCH_BUILD)
 
 CLEANFILES = $(bin_SCRIPTS) $(noinst_SCRIPTS) $(bashcomp_DATA) \
-	$(BUILT_SOURCES) $(CLEAN_SRCS) $(CLEAN_POFILES)
+	$(CLEAN_SRCS) $(CLEAN_POFILES)
 
+DISTCLEANFILES = src/xgettext.opts src/pch-build.hh.gch.dep
+
+# We make GMO files part of the source distribution.  This means we can't
+# clean them away like other files, but a maintainer might still want to
+# get rid of them to rebuild them.
+# The same goes for src/package_revision.txt and
+# src/package_full_revision_dist.txt
+
+MAINTAINERCLEANFILES = $(MAINTAINERCLEAN_POFILES) \
+	src/package_revision.txt src/package_full_revision_dist.txt
+
 # 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
 # standard flags variables are inappropriate.
============================================================
--- doc/monotone.texi	5c18cff828089e592f5f2d53c2d60793715a4a40
+++ doc/monotone.texi	0e40017dfe8ba652e6af4585a2ac176c8bd12dcc
@@ -1045,19 +1045,38 @@ @subsection Branch Names
 
 @subsection Branch Names
 
-The branch names used in the above section are fine for an example, but
-they would be bad to use in a real project.  The reason is, monotone
-branch names must be @emph{globally} unique, over all branches in the
-world.  Otherwise, bad things can happen.  Fortunately, we have a handy
-source of globally unique names --- the DNS system.
+The branch names used in the above section are fine for an example,
+but they would be bad to use in a real project.  The reason is,
+monotone branch names should be @emph{globally} unique, over all
+branches in the world.  Otherwise, when your branch eventually gets
+distributed, you could get name collisions with other people's
+work.
 
-When naming a branch, always prepend the reversed, fully qualified, domain
-name of a host that you control or are otherwise authorized to use.  For
-example, monotone development happens on the branch @code{net.venge.monotone},
-because @code{venge.net} belongs to monotone's original author.  The idea is
-that this way, you can coordinate with other people using a host to make sure
-there are no conflicts --- in the example, monotone's original author can
-be certain that no-one else using @code{venge.net} will start up a
+Having two separate projects with the same monotone branch names means
+those projects cannot be stored in the same database. In general,
+monotone supports storing unrelated branches in a single database,
+which simplifies servers. But that requires unique branch names, so
+ensuring globally unique branch names allows using globally accessible
+monotone servers.
+
+monotone does @emph{not} support renaming branches (because that would
+be modifying history), so choosing a good branch name up front is
+important. It is possible to work around this by propagating from your
+branch to one with a better name, but that is a painful process if
+there are many people using the original branch name.
+
+Even if you are @emph{absolutely} sure that your branch will never be
+distributed, things could change in the future!
+
+Fortunately, we have a handy source of globally unique names --- the
+DNS system. When naming a branch, always prepend the reversed, fully
+qualified, domain name of a host that you control or are otherwise
+authorized to use.  For example, monotone development happens on the
+branch @code{net.venge.monotone}, because @code{venge.net} belongs to
+monotone's original author.  The idea is that this way, you can
+coordinate with other people using a host to make sure there are no
+conflicts --- in the example, monotone's original author can be
+certain that no-one else using @code{venge.net} will start up a
 different program named @code{monotone}.  If you work for Yoyodyne,
 Inc. (owners of yoyodyne.com), then all your branch names should look
 like @address@hidden
@@ -4659,7 +4678,8 @@ @subsection Global Options
 
 @item --help
 Display help information. This is the same as the @command{mtn help}
-command.
+command, but note that it can be placed at the end of a command line,
+while @command{mtn help} must be the first non-option on the command line.
 
 @item --ignore-suspend-certs
 @itemx --no-ignore-suspend-certs
============================================================
--- po/sv.po	f3f16f8383155e49bf182deb6fd93ed68ce61ea7
+++ po/sv.po	40733217ce5e8271ca5d235b14094cd258f2171e
@@ -7,8 +7,8 @@ msgstr ""
 msgstr ""
 "Project-Id-Version: monotone\n"
 "Report-Msgid-Bugs-To: https://code.monotone.ca/p/monotone/issues/\n"
-"POT-Creation-Date: 2011-02-18 02:39+0100\n"
-"PO-Revision-Date: 2011-02-18 02:53+0100\n"
+"POT-Creation-Date: 2011-02-23 12:31+0100\n"
+"PO-Revision-Date: 2011-02-23 12:58+0100\n"
 "Last-Translator: tommyd <address@hidden>\n"
 "Language-Team: LANGUAGE <address@hidden>\n"
 "Language: sv\n"
@@ -773,7 +773,10 @@ msgid ""
 "monotone was written originally by Graydon Hoare <address@hidden> in 2003 "
 "and has since then received numerous contributions from many individuals. A "
 "complete list of authors can be found in AUTHORS."
-msgstr "monotone skrevs ursprungligen av Graydon Hoare <address@hidden> år 2003 och har fått en hel del bidrag från många individer sen dess.  I AUTHORS finner man en komplett lista på författare."
+msgstr ""
+"monotone skrevs ursprungligen av Graydon Hoare <address@hidden> år 2003 "
+"och har fått en hel del bidrag från många individer sen dess.  I AUTHORS "
+"finner man en komplett lista på författare."
 
 #: src/cmd.cc:954
 msgid ""
@@ -792,7 +795,9 @@ msgid ""
 msgid ""
 "monotone and this man page is Copyright (c) 2003 \\- %s by the monotone "
 "development team."
-msgstr "monotone och den här manualsidan har Copyright (c) 2003 \\- %s tillhörande 'the monotone development team'."
+msgstr ""
+"monotone och den här manualsidan har Copyright (c) 2003 \\- %s tillhörande "
+"'the monotone development team'."
 
 #: src/cmd.cc:970
 #, c-format
@@ -873,7 +878,8 @@ msgid "would receive %d revisions, %d ce
 #: src/cmd_netsync.cc:293
 #, c-format
 msgid "would receive %d revisions, %d certs, and at least %d keys\n"
-msgstr "skulle ha tagit emot %d revisioner, %d certifikat och minst %d nycklar\n"
+msgstr ""
+"skulle ha tagit emot %d revisioner, %d certifikat och minst %d nycklar\n"
 
 #: src/cmd_netsync.cc:300
 #, c-format
@@ -1171,7 +1177,7 @@ msgstr "Visa vilka databaser som hantera
 
 #: src/cmd_list.cc:684 src/database.cc:4977
 #, c-format
-msgid "could not query default database locations"
+msgid "no default database location configured"
 msgstr "ingen standardkatalog för databaser finns definierad"
 
 #: src/cmd_list.cc:688 src/database.cc:5055
@@ -5297,7 +5303,7 @@ msgstr "grenmönstret är tomt och inget
 msgid "branch pattern is empty and no default value could be loaded"
 msgstr "grenmönstret är tomt och inget standardmönster satt"
 
-#: src/network/connection_info.cc:426
+#: src/network/connection_info.cc:428
 #, c-format
 msgid ""
 "include / exclude pattern was given both as part of the URL and as a "
@@ -5306,7 +5312,7 @@ msgstr ""
 "mönster för inkludering eller exkludering gavs både som del av URLen och som "
 "separata argument."
 
-#: src/network/connection_info.cc:474
+#: src/network/connection_info.cc:477
 #, c-format
 msgid ""
 "no branch pattern found in URI, will try to use suitable database defaults "
@@ -5315,7 +5321,7 @@ msgstr ""
 "inget grenmönster funnet i URI, provar med passande standarder för databasen "
 "om sådan finns tillgänglig"
 
-#: src/network/connection_info.cc:496
+#: src/network/connection_info.cc:499
 #, c-format
 msgid ""
 "separate server and pattern arguments are deprecated, please consider using "
@@ -5324,7 +5330,7 @@ msgstr ""
 "separata argument för server och grenmönster är föråldrat, var god överväg "
 "att använda en URI istället"
 
-#: src/network/connection_info.cc:504
+#: src/network/connection_info.cc:508
 #, c-format
 msgid ""
 "you can specify either a query string or separate include/exclude "
@@ -5333,7 +5339,7 @@ msgstr ""
 "man kan antingen ange en söksträng i URIn eller flaggorna --include och --"
 "exclude, men inte båda samtidigt"
 
-#: src/network/connection_info.cc:524
+#: src/network/connection_info.cc:529
 #, c-format
 msgid ""
 "need permission to store persistent passphrase (see hook persist_phrase_ok())"
@@ -5341,7 +5347,7 @@ msgstr ""
 "behöver tillstånd att använda ett permanent lösenord (se lua-"
 "rutinenpersist_phrase_ok())"
 
-#: src/network/connection_info.cc:538
+#: src/network/connection_info.cc:533
 #, c-format
 msgid ""
 "The --no-transport-auth option is usually only used in combination with --"
============================================================
--- src/base.hh	8ee936d762b2115fbaa7e54dc25ee634490c5fc9
+++ src/base.hh	a8d19ce4d4aab1fcfbc2f868fd09779c3c0e3ffa
@@ -16,6 +16,11 @@
 // Configuration directives
 #include "config.h"
 
+// autoconf prior to 2.64 doesn't define this
+#ifndef PACKAGE_URL
+#define PACKAGE_URL "http://www.monotone.ca"
+#endif
+
 #define BOOST_DISABLE_THREADS
 #define BOOST_SP_DISABLE_THREADS
 #define BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
============================================================
--- extra/shell/monotone.bash_completion.in	a878e6fa815f84f18961fb2366d0235376be8c29
+++ extra/shell/monotone.bash_completion.in	073ee99c02184196639fb088fe427df20264e64d
@@ -68,6 +68,17 @@ _monotone_files() {
     _filedir
 }
 
+_monotone_databases() {
+    _filedir
+    COMPREPLY=(
+	"address@hidden"
+	$(compgen -W "$(LANG=POSIX \
+                        ${mtn} list databases 2> /dev/null |\
+                        grep -v '^\s' |\
+                        sed -e 's/(in [^)]*):$//')" -- ${cur#*=} )
+    )
+}
+
 # Call monotone to complete key ids (private or public)
 _monotone_keys() {
     local range
============================================================
--- extra/shell/monotone_gen_bash_completion_table.pl	d9622d595d6e8dc1d66a5b91af5e4c967e364a9a
+++ extra/shell/monotone_gen_bash_completion_table.pl	724f810ba4f531c872f33f966d1ff04c5adb03c7
@@ -103,33 +103,33 @@ print "_monotone_options_arg_fns=(\n";
 
 print "declare -A _monotone_options_arg_fns\n";
 print "_monotone_options_arg_fns=(\n";
-print "    [--authors-file]=_filedir\n";
+print "    [--authors-file]=_monotone_files\n";
 print "    [--bind]=_monotone_address_port\n";
 print "    [--branch]=_monotone_branches [-b]=_monotone_branches\n";
-print "    [--branches-file]=_filedir\n";
+print "    [--branches-file]=_monotone_files\n";
 print "    [--confdir]=_monotone_dir\n";
-print "    [--conflicts-file]=_filedir\n";
-print "    [--db]=_filedir [-d]=_filedir\n";
-print "    [--dump]=_filedir\n";
-print "    [--export-marks]=_filedir\n";
+print "    [--conflicts-file]=_monotone_files\n";
+print "    [--db]=_monotone_databases [-d]=_monotone_databases\n";
+print "    [--dump]=_monotone_files\n";
+print "    [--export-marks]=_monotone_files\n";
 print "    [--from]=_monotone_revision\n";
-print "    [--import-marks]=_filedir\n";
+print "    [--import-marks]=_monotone_files\n";
 print "    [--keydir]=_monotone_dir\n";
 print "    [--key]=_monotone_key [-k]=_monotone_public_key\n";
 print "    [--key-to-push]=_monotone_public_key\n";
-print "    [--log]=_filedir\n";
-print "    [--message_file]=_filedir\n";
-print "    [--pid-file]=_filedir\n";
-print "    [--rcfile]=_filedir\n";
+print "    [--log]=_monotone_files\n";
+print "    [--message_file]=_monotone_files\n";
+print "    [--pid-file]=_monotone_files\n";
+print "    [--rcfile]=_monotone_files\n";
 print "    [--refs]=_monotone_refs\n";
 print "    [--remote-stdio-host]=_monotone_address_port\n";
-print "    [--resolve-conflicts-file]=_filedir\n";
+print "    [--resolve-conflicts-file]=_monotone_files\n";
 print "    [--revision]=_monotone_revision [-r]=_monotone_revision\n";
 print "    [--root]=_monotone_dir\n";
 print "    [--ssh-sign]=_monotone_ssh_sign\n";
 print "    [--ticker]=_monotone_ticker\n";
-print "    [--xargs]=_filedir\n";
-print "    address@hidden";
+print "    [--xargs]=_monotone_files\n";
+print "    address@hidden";
 print ")\n";
 
 print "declare -A _monotone_aliases\n";
============================================================
--- doc/Makefile.am	88c2b91289880ea9c9ef32f08e224547287f8fd7
+++ doc/Makefile.am	dcc8331723e96245ccf9788fef5c02946580031e
@@ -48,9 +48,9 @@ EXTRA_DIST = \
 monotone_TEXINFOS = $(top_srcdir)/src/std_hooks.lua $(TEXI_FRAGMENTS)
 
 EXTRA_DIST = \
-	$(PDF_FIGURES) $(PNG_FIGURES) $(TEXI_FRAGMENTS)	$(HTML_EXTRA)	\
+	$(PDF_FIGURES) $(PNG_FIGURES) $(PNG_IMAGES) $(TEXI_FRAGMENTS)	\
 	figures/monotone-logo.svg figures/oo-figures.sxd		\
-	figures/pdfcrop.pl figures/README
+	figures/pdfcrop.pl figures/README $(HTML_EXTRA)
 
 AM_MAKEINFOFLAGS= -I $(top_srcdir)/src -I $(srcdir)
 
============================================================
--- 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_diff_log.cc	94a354875b587d372e6d0898ab6fc8355ce29c21
+++ src/cmd_diff_log.cc	4a61bfb4b9c1066fcc650b2bc634ce582729ebb1
@@ -587,7 +587,7 @@ log_print_rev (app_state &      app,
       if (!app.opts.no_files)
         {
           utf8 summary;
-          revision_summary(rev, summary);
+          revision_summary(rev, summary, friendly_node_summary);
           external summary_external;
           utf8_to_system_best_effort(summary, summary_external);
           out << summary_external;
============================================================
--- src/cmd_list.cc	eede6b49bfe267b8e9b361c12bbcc26f53e86191
+++ src/cmd_list.cc	b51a543bb760d2fb37eda377a229ee56f9c24c60
@@ -12,9 +12,12 @@
 #include "safe_map.hh"
 #include <utility>
 #include <iostream>
+#include <sstream>
+#include <set>
 #include <iterator>
 
 #include <boost/tuple/tuple.hpp>
+#include <boost/bind.hpp>
 
 #include "basic_io.hh"
 #include "cert.hh"
@@ -27,6 +30,7 @@
 #include "key_store.hh"
 #include "restrictions.hh"
 #include "revision.hh"
+#include "rev_output.hh"
 #include "simplestring_xform.hh"
 #include "transforms.hh"
 #include "ui.hh"
@@ -45,6 +49,7 @@ using std::ostream;
 using std::sort;
 using std::copy;
 using std::ostream;
+using std::ostringstream;
 using std::string;
 using std::vector;
 
@@ -847,56 +852,73 @@ CMD(missing, "missing", "", CMD_REF(list
        ostream_iterator<file_path>(cout, "\n"));
 }
 
+namespace
+{
+  namespace
+  {
+    std::string
+    changed_nodes_summary(set<file_path> & output_files,
+                          node_status const status, file_path const & fp_first,
+                          file_path const & fp_second, attr_key const & key,
+                          attr_value const & value);
 
+    std::string
+    changed_nodes_summary(set<file_path> & output_files,
+                          node_status const status, file_path const & fp_first,
+                          file_path const & fp_second, attr_key const & key,
+                          attr_value const & value)
+    {
+      // our output is accumulated in output_files as we only care about the
+      // unique file_path's
+
+      // we output the new filename (fp_second) for renames,
+      // and the original (fp_first) for the others as they don't have a
+      // new filename
+      if (status == renamed)
+        output_files.insert(fp_second);
+      else
+        output_files.insert(fp_first);
+
+      return "";
+    }
+  }
+};
+
 CMD(changed, "changed", "", CMD_REF(list), "[PATH...]",
     N_("Lists files that have changed with respect to the current revision"),
     "",
     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<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);
+  utf8 summary;
+  set<file_path> output_files;
+  revision_summary(rev, summary,
+                   bind(changed_nodes_summary, boost::ref(output_files),
+                   _1, _2, _3, _4, _5));
 
-      for (set<node_id>::const_iterator i = nodes.begin(); i != nodes.end();
-           ++i)
-        {
-          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);
-        }
-    }
-
-  copy(print_paths.begin(), print_paths.end(),
+  copy(output_files.begin(), output_files.end(),
        ostream_iterator<file_path>(cout, "\n"));
 }
 
============================================================
--- src/cmd_ws_commit.cc	7b91a53d8eec4e78b062092f85c945bbaaefe23a
+++ src/cmd_ws_commit.cc	9a9d30688c6a62be6568758d004b5aa3a8c89ee5
@@ -259,7 +259,7 @@ get_log_message_interactively(lua_hooks 
   }
 
   utf8 summary;
-  revision_summary(rev, summary);
+  revision_summary(rev, summary, friendly_node_summary);
 
   utf8 full_message(changelog() + cancel() + instructions() + editable() + ignored() +
                     notes() + summary(),
@@ -968,7 +968,7 @@ CMD(status, "status", "", CMD_REF(inform
 
   revision_header(rid, rev, author, date_t::now(), app.opts.branch, changelog,
                   date_fmt, header);
-  revision_summary(rev, summary);
+  revision_summary(rev, summary, friendly_node_summary);
 
   external header_external;
   external summary_external;
============================================================
--- src/rev_output.cc	a2c70b893b31296917d1a2b974faa1da46c13f1e
+++ src/rev_output.cc	26d81fbb1a78bfa09ec43a5396c58e75b2a07d66
@@ -119,8 +119,59 @@ revision_header(revision_id const rid, r
   header = utf8(out.str(), origin::internal);
 }
 
+string
+friendly_node_summary(node_status const status, file_path const & fp_first,
+                      file_path const & fp_second, attr_key const & key,
+                      attr_value const & value)
+{
+  ostringstream out;
+
+  switch (status)
+    {
+      case dropped:
+        out << (F("  dropped  %s") % fp_first);
+        break;
+    
+      case renamed:
+        out << (F("  renamed  %s\n"
+                  "       to  %s") % fp_first % fp_second);
+        break;
+
+      case added:
+        out << (F("  added    %s") % fp_first);
+        break;
+
+      case patched:
+        out << (F("  patched  %s") % fp_first);
+        break;
+
+      case attr_set:
+        out << (F("  attr on  %s\n"
+                  "      set  %s\n"
+                  "       to  %s")
+                % fp_first % key % value);
+        break;
+
+      case attr_unset:
+        out << (F("  attr on  %s\n"
+                  "    unset  %s") % fp_first % key);
+        break;
+
+      default:
+        I(false); // should never get here
+        break;
+    }
+
+  return out.str();
+}
+
 void
-revision_summary(revision_t const & rev, utf8 & summary)
+revision_summary(revision_t const & rev, utf8 & summary,
+                 boost::function<std::string(node_status const,
+                                 file_path const &,
+                                 file_path const &,
+                                 attr_key const &,
+                                 attr_value const &)> node_summary_fn)
 {
   // We intentionally do not collapse the final \n into the format
   // strings here, for consistency with newline conventions used by most
@@ -130,6 +181,10 @@ revision_summary(revision_t const & rev,
   revision_id rid;
   calculate_ident(rev, rid);
 
+  attr_key dummy_key;
+  attr_value dummy_value;
+  file_path dummy_file;
+
   for (edge_map::const_iterator i = rev.edges.begin(); i != rev.edges.end(); ++i)
     {
       revision_id parent = edge_old_revision(*i);
@@ -148,32 +203,34 @@ revision_summary(revision_t const & rev,
 
       for (set<file_path>::const_iterator i = cs.nodes_deleted.begin();
             i != cs.nodes_deleted.end(); ++i)
-        out << (F("  dropped  %s") %*i) << '\n';
+        out << node_summary_fn(dropped, *i, dummy_file, dummy_key,
+                               dummy_value) << '\n';
 
       for (map<file_path, file_path>::const_iterator
             i = cs.nodes_renamed.begin();
             i != cs.nodes_renamed.end(); ++i)
-        out << (F("  renamed  %s\n"
-                  "       to  %s") % i->first % i->second) << '\n';
+        out << node_summary_fn(renamed, i->first, i->second,
+                               dummy_key, dummy_value) << '\n';
 
       for (set<file_path>::const_iterator i = cs.dirs_added.begin();
             i != cs.dirs_added.end(); ++i)
-        out << (F("  added    %s") % *i) << '\n';
+        out << node_summary_fn(added, *i, dummy_file, dummy_key,
+                               dummy_value) << '\n';
 
       for (map<file_path, file_id>::const_iterator i = cs.files_added.begin();
             i != cs.files_added.end(); ++i)
-        out << (F("  added    %s") % i->first) << '\n';
+        out << node_summary_fn(added, i->first, dummy_file,
+                               dummy_key, dummy_value) << '\n';
 
       for (map<file_path, pair<file_id, file_id> >::const_iterator
               i = cs.deltas_applied.begin(); i != cs.deltas_applied.end(); ++i)
-        out << (F("  patched  %s") % i->first) << '\n';
+        out << node_summary_fn(patched, i->first, dummy_file,
+                               dummy_key, dummy_value) << '\n';
 
       for (map<pair<file_path, attr_key>, attr_value >::const_iterator
              i = cs.attrs_set.begin(); i != cs.attrs_set.end(); ++i)
-        out << (F("  attr on  %s\n"
-                  "      set  %s\n"
-                  "       to  %s")
-                % i->first.first % i->first.second % i->second) << '\n';
+        out << node_summary_fn(attr_set, i->first.first, dummy_file,
+                               i->first.second, i->second) << '\n';
 
       // FIXME: naming here could not be more inconsistent
       // the cset calls it attrs_cleared
@@ -183,8 +240,8 @@ revision_summary(revision_t const & rev,
 
       for (set<pair<file_path, attr_key> >::const_iterator
              i = cs.attrs_cleared.begin(); i != cs.attrs_cleared.end(); ++i)
-        out << (F("  attr on  %s\n"
-                  "    unset  %s") % i->first % i->second) << '\n';
+        out << node_summary_fn(attr_unset, i->first, dummy_file,
+                               i->second, dummy_value) << '\n';
 
       out << '\n';
     }
============================================================
--- src/rev_output.hh	666dd3ed35e16d8b122b4932c2aad05a21a22e25
+++ src/rev_output.hh	6d5263e826dac07b647fccca09062d3598384f3f
@@ -10,6 +10,8 @@
 #ifndef __REV_SUMMARY_HH__
 #define __REV_SUMMARY_HH__
 
+#include <boost/function.hpp>
+
 #include "rev_types.hh"
 #include "vocab.hh"
 
@@ -27,8 +29,28 @@ revision_header(revision_id const rid, r
                 std::vector<cert> const & certs, std::string const & date_fmt,
                 utf8 & header);
 
+enum node_status
+{
+  added,
+  attr_set,
+  attr_unset,
+  dropped,
+  patched,
+  renamed
+};
+
+std::string
+friendly_node_summary(node_status const status, file_path const & fp_first,
+                      file_path const & fp_second, attr_key const & key,
+                      attr_value const & value);
+
 void
-revision_summary(revision_t const & rev, utf8 & summary);
+revision_summary(revision_t const & rev, utf8 & summary,
+                 boost::function<std::string(node_status const,
+                                 file_path const &,
+                                 file_path const &,
+                                 attr_key const &,
+                                 attr_value const &)> node_summary_fn);
 
 #endif  // header guard
 

reply via email to

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