[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] another patch (no checkin)
From: |
Tom Tromey |
Subject: |
[Monotone-devel] another patch (no checkin) |
Date: |
06 Sep 2003 21:31:33 -0600 |
This patch lets you specify one or two revisions to `monotone diff'.
It is analogous to using cvs diff -r.
I'm not checking this in since, while I think this functionality is
needed, first I think we should look at the UI a bit more.
One nice thing about the cvs approach is you can also run diff on a
given file, or versions of a file. Perhaps we could have a -r option
(opening the door to options processing in the commands
themselves...?). I presume the argument to -r would be the manifest
signature.
It may make sense to look at subversion to see what UI they have
picked. There really is a fair amount of commonality here between
different version control systems, I think, despite their other
differences. And I know the svn guys have put a lot of thought into
it.
BTW in the patch there are apparently spurious whitespace differences.
I don't understand that, unless it is something emacs did
automatically. According to the patch text these aren't even changes
-- monotone bug perhaps?
Tom
--- ChangeLog
+++ ChangeLog
@@ -1,5 +1,7 @@
2003-09-06 Tom Tromey <address@hidden>
+ * commands.cc (diff): Allow arguments specifying diff revisions.
+
* update.cc (pick_update_target): Not an error if nothing to
update.
--- commands.cc
+++ commands.cc
@@ -1352,15 +1352,43 @@
transaction_guard guard(app.db);
- get_manifest_map(m_old);
- calculate_new_manifest_map(m_old, m_new);
+ if (args.size() > 0)
+ {
+ manifest_data dat;
+ manifest_id ident(args[0]);
+
+ N(app.db.manifest_version_exists(ident),
+ (string("no file version ") + ident.inner()() + " found in database"));
+
+ L("getting manifest %s\n", ident.inner()().c_str());
+ app.db.get_manifest_version(ident, dat);
+ read_manifest_map(dat, m_old);
+ }
+ else
+ get_manifest_map(m_old);
+
+ if (args.size() > 1)
+ {
+ manifest_data dat;
+ manifest_id ident(args[1]);
+
+ N(app.db.manifest_version_exists(ident),
+ (string("no file version ") + ident.inner()() + " found in database"));
+
+ L("getting manifest %s\n", ident.inner()().c_str());
+ app.db.get_manifest_version(ident, dat);
+ read_manifest_map(dat, m_new);
+ }
+ else
+ calculate_new_manifest_map(m_old, m_new);
+
manifests_to_patch_set(m_old, m_new, app, ps);
for (set<patch_delta>::const_iterator i = ps.f_deltas.begin();
i != ps.f_deltas.end(); ++i)
{
- file_data f_old;
- gzip<data> decoded_old;
+ file_data f_old, f_new;
+ gzip<data> decoded_old, decoded_new;
data decompressed_old, decompressed_new;
vector<string> old_lines, new_lines;
@@ -1368,7 +1396,14 @@
decode_base64(f_old.inner(), decoded_old);
decode_gzip(decoded_old, decompressed_old);
- read_data(i->path, decompressed_new);
+ if (args.size() > 1)
+ {
+ app.db.get_file_version(i->id_new, f_new);
+ decode_base64(f_new.inner(), decoded_new);
+ decode_gzip(decoded_new, decompressed_new);
+ }
+ else
+ read_data(i->path, decompressed_new);
split_into_lines(decompressed_old(), old_lines);
split_into_lines(decompressed_new(), new_lines);
@@ -1547,7 +1554,7 @@
guard.commit();
}
-
+
CMD(agraph, "graph visualization", "", "dump ancestry graph to stdout")
{
vector< manifest<cert> > certs;
@@ -1654,7 +1654,7 @@
guard.commit();
}
-
+
CMD(cvs_import, "rcs", "<cvsroot>", "import all versions in CVS repository")
{
if (args.size() != 1)
- [Monotone-devel] another patch (no checkin),
Tom Tromey <=