[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone: e7de71b0f9fd6113f13b00eedd
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone: e7de71b0f9fd6113f13b00eeddfdcd8aa57bcd78 |
Date: |
Fri, 14 Jan 2011 00:48:55 GMT |
revision: e7de71b0f9fd6113f13b00eeddfdcd8aa57bcd78
date: 2011-01-14T00:48:40
author: address@hidden
branch: net.venge.monotone
changelog:
* cmd_diff_log.cc (dump_diff): record the files to diff in a
multimap, then output them in alphabetical order (fixes issue 102)
* tests/diff_order/*: added a test case
* NEWS: noted
manifest:
format_version "1"
new_manifest [d68ac37bcabb829b375023f6950f9998c9bb6247]
old_revision [7e43e45141257b14a1ddca08f8cb079f26f78c0c]
add_dir "tests/diff_order"
add_file "tests/diff_order/__driver__.lua"
content [f8ac87ad794d13f3f493be5f2bd934ae75c59053]
add_file "tests/diff_order/expected1"
content [10c9753513afbbaa9756ddab1e47c6ed59681d20]
add_file "tests/diff_order/expected2"
content [bf6848cb727c9d3636059d2b53998c2135279c55]
patch "NEWS"
from [f9ce17392993af31e59748c969baa33ab5296c42]
to [34d53f7ab5939ffe056625389f73f43fd1de7388]
patch "cmd_diff_log.cc"
from [a3014082674ecb9c3b0617a9603b03452723fec9]
to [7bc853e14df844cd704eeb8d3b54ab4fe9bfde06]
============================================================
--- NEWS f9ce17392993af31e59748c969baa33ab5296c42
+++ NEWS 34d53f7ab5939ffe056625389f73f43fd1de7388
@@ -24,9 +24,9 @@ XXX XXX XX XX:XX:XX UTC 2010
New Features
- 'mtn conflicts store' now outputs a count of the conflicts,
- and the name of the conflicts file.
+ and the name of the conflicts file.
(fixes monotone issue 108)
-
+
Bugs fixed
- The internal line merger will actually preserve your line
@@ -34,7 +34,11 @@ XXX XXX XX XX:XX:XX UTC 2010
- Improve help, fix arg indexing in 'conflicts resolve_first'
(fixes monotone issue 101)
-
+
+ - A regression from 0.48 prevented monotone from ordering the
+ diff output of individual files alphabetically.
+ (fixes monotone issue 102)
+
- 'mtn privkey' did not recognize private keys solely available
in the key store. this has been fixed.
============================================================
--- cmd_diff_log.cc a3014082674ecb9c3b0617a9603b03452723fec9
+++ cmd_diff_log.cc 7bc853e14df844cd704eeb8d3b54ab4fe9bfde06
@@ -115,6 +115,13 @@ dump_diff(lua_hooks & lua,
}
}
+struct diff_node_data
+{
+ file_path left_path;
+ file_path right_path;
+ file_id left_id;
+ file_id right_id;
+};
static void
dump_diffs(lua_hooks & lua,
@@ -129,6 +136,10 @@ dump_diffs(lua_hooks & lua,
bool right_from_db,
bool show_encloser)
{
+ // Put all node data in a multimap with the file path of the node as key
+ // which gets automatically sorted. For removed nodes the file path is
+ // the left_path, for added, patched and renamed nodes it is the right_path.
+ std::multimap<file_path, diff_node_data> path_node_data;
parallel::iter<node_map> i(left_roster.all_nodes(), right_roster.all_nodes());
while (i.next())
{
@@ -142,57 +153,29 @@ dump_diffs(lua_hooks & lua,
// deleted
if (is_file_t(i.left_data()))
{
- file_path left_path, right_path;
- left_roster.get_name(i.left_key(), left_path);
+ diff_node_data dat;
+ left_roster.get_name(i.left_key(), dat.left_path);
// right_path is null
- file_id left_id, right_id;
- left_id = downcast_to_file_t(i.left_data())->content;
+ dat.left_id = downcast_to_file_t(i.left_data())->content;
// right_id is null
- data left_data, right_data;
- get_data(db, left_path, left_id, left_from_db, left_data);
- // right_data is null
-
- string encloser("");
- if (show_encloser)
- lua.hook_get_encloser_pattern(left_path, encloser);
-
- dump_diff(lua,
- left_path, right_path,
- left_id, right_id,
- left_data, right_data,
- diff_format, external_diff_args_given, external_diff_args,
- encloser, output);
- }
+ path_node_data.insert(make_pair(dat.left_path, dat));
+ }
break;
case parallel::in_right:
// added
if (is_file_t(i.right_data()))
{
- file_path left_path, right_path;
+ diff_node_data dat;
// left_path is null
- right_roster.get_name(i.right_key(), right_path);
+ right_roster.get_name(i.right_key(), dat.right_path);
- file_id left_id, right_id;
// left_id is null
- right_id = downcast_to_file_t(i.right_data())->content;
+ dat.right_id = downcast_to_file_t(i.right_data())->content;
- data left_data, right_data;
- // left_data is null
- get_data(db, right_path, right_id, right_from_db, right_data);
-
- string encloser("");
- if (show_encloser)
- lua.hook_get_encloser_pattern(right_path, encloser);
-
- dump_diff(lua,
- left_path, right_path,
- left_id, right_id,
- left_data, right_data,
- diff_format, external_diff_args_given, external_diff_args,
- encloser, output);
+ path_node_data.insert(make_pair(dat.right_path, dat));
}
break;
@@ -200,36 +183,45 @@ dump_diffs(lua_hooks & lua,
// moved/renamed/patched/attribute changes
if (is_file_t(i.left_data()))
{
+ diff_node_data dat;
+ dat.left_id = downcast_to_file_t(i.left_data())->content;
+ dat.right_id = downcast_to_file_t(i.right_data())->content;
- file_id left_id, right_id;
- left_id = downcast_to_file_t(i.left_data())->content;
- right_id = downcast_to_file_t(i.right_data())->content;
-
- if (left_id == right_id)
+ if (dat.left_id == dat.right_id)
continue;
- file_path left_path, right_path;
- left_roster.get_name(i.left_key(), left_path);
- right_roster.get_name(i.right_key(), right_path);
+ left_roster.get_name(i.left_key(), dat.left_path);
+ right_roster.get_name(i.right_key(), dat.right_path);
- data left_data, right_data;
- get_data(db, left_path, left_id, left_from_db, left_data);
- get_data(db, right_path, right_id, right_from_db, right_data);
-
- string encloser("");
- if (show_encloser)
- lua.hook_get_encloser_pattern(right_path, encloser);
-
- dump_diff(lua,
- left_path, right_path,
- left_id, right_id,
- left_data, right_data,
- diff_format, external_diff_args_given, external_diff_args,
- encloser, output);
+ path_node_data.insert(make_pair(dat.right_path, dat));
}
break;
}
}
+
+ for (std::multimap<file_path, diff_node_data>::iterator i = path_node_data.begin();
+ i != path_node_data.end(); ++i)
+ {
+ diff_node_data & dat = (*i).second;
+ data left_data, right_data;
+
+ if (!null_id(dat.left_id))
+ get_data(db, dat.left_path, dat.left_id, left_from_db, left_data);
+
+ if (!null_id(dat.right_id))
+ get_data(db, dat.right_path, dat.right_id, right_from_db, right_data);
+
+ string encloser("");
+ if (show_encloser)
+ lua.hook_get_encloser_pattern((*i).first, encloser);
+
+ dump_diff(lua,
+ dat.left_path, dat.right_path,
+ dat.left_id, dat.right_id,
+ left_data, right_data,
+ diff_format, external_diff_args_given, external_diff_args,
+ encloser, output);
+ }
}
// common functionality for diff and automate content_diff to determine
============================================================
--- /dev/null
+++ tests/diff_order/__driver__.lua f8ac87ad794d13f3f493be5f2bd934ae75c59053
@@ -0,0 +1,31 @@
+mtn_setup()
+
+check(get("expected1"))
+check(get("expected2"))
+
+-- add two files in two revisions, where the second
+-- gets a bigger internal node id than the first
+addfile("ccc", "foobar")
+commit()
+addfile("bbb", "barbaz")
+commit()
+
+writefile("bbb", "new stuff")
+writefile("ccc", "new stuff")
+
+-- now ensure that the patch is not ordered by node id,
+-- where bbb would have to come first, but by file name
+check(mtn("diff"), 0, true, false)
+check(samefile("stdout", "expected1"))
+
+commit()
+
+-- add a new file and drop an existing one, the order
+-- should still be alphabetical
+addfile("aaa", "even newer")
+writefile("ccc", "even newer")
+check(mtn("drop", "bbb"), 0, false, false)
+
+check(mtn("diff"), 0, true, false)
+check(samefile("stdout", "expected2"))
+
============================================================
--- /dev/null
+++ tests/diff_order/expected1 10c9753513afbbaa9756ddab1e47c6ed59681d20
@@ -0,0 +1,27 @@
+#
+# old_revision [c263739ff64bb637b6535bf8399322a7d8d6fadd]
+#
+# patch "bbb"
+# from [32b1bf1853e6c39e4a1c3dae941ab7094ff1d293]
+# to [e81daec0385673562ae66971d78bfd91bb92c276]
+#
+# patch "ccc"
+# from [8843d7f92416211de9ebb963ff4ce28125932878]
+# to [e81daec0385673562ae66971d78bfd91bb92c276]
+#
+============================================================
+--- bbb 32b1bf1853e6c39e4a1c3dae941ab7094ff1d293
++++ bbb e81daec0385673562ae66971d78bfd91bb92c276
+@@ -1 +1 @@
+-barbaz
+\ No newline at end of file
++new stuff
+\ No newline at end of file
+============================================================
+--- ccc 8843d7f92416211de9ebb963ff4ce28125932878
++++ ccc e81daec0385673562ae66971d78bfd91bb92c276
+@@ -1 +1 @@
+-foobar
+\ No newline at end of file
++new stuff
+\ No newline at end of file
============================================================
--- /dev/null
+++ tests/diff_order/expected2 bf6848cb727c9d3636059d2b53998c2135279c55
@@ -0,0 +1,32 @@
+#
+# old_revision [e7b993188a210fc543abb39f47b84e7971a74396]
+#
+# delete "bbb"
+#
+# add_file "aaa"
+# content [23dcbe46f65d262e79d2ccbb3d34efce68dfd602]
+#
+# patch "ccc"
+# from [e81daec0385673562ae66971d78bfd91bb92c276]
+# to [23dcbe46f65d262e79d2ccbb3d34efce68dfd602]
+#
+============================================================
+--- /dev/null
++++ aaa 23dcbe46f65d262e79d2ccbb3d34efce68dfd602
+@@ -0,0 +1 @@
++even newer
+\ No newline at end of file
+============================================================
+--- bbb e81daec0385673562ae66971d78bfd91bb92c276
++++ /dev/null
+@@ -1 +0,0 @@
+-new stuff
+\ No newline at end of file
+============================================================
+--- ccc e81daec0385673562ae66971d78bfd91bb92c276
++++ ccc 23dcbe46f65d262e79d2ccbb3d34efce68dfd602
+@@ -1 +1 @@
+-new stuff
+\ No newline at end of file
++even newer
+\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone: e7de71b0f9fd6113f13b00eeddfdcd8aa57bcd78,
code <=