[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Update replacing deleted files
From: |
Hans Fuchs |
Subject: |
[Monotone-devel] Update replacing deleted files |
Date: |
Mon, 16 Aug 2004 02:03:51 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040616 |
Hello
I'd like update to replace deleted files. I tried to implement that
myself. It brought up a lot of questions (maybe too much since I only
added few lines). I think it is easier for someone experienced with
monotone to fix it than answering all my questions. Here they are
nonetheless:
I attached my changes sofar. Warning they are very dilettante. It works
although.
- Is build_manifest_map() the right place to do this?
- Is there a nice way to find out, that I'm inside update cmd?
- The code is quite similar to a part of checkout cmd, can I make it
method to call from checkout cmd and build_manifest_map()?
- Did I forget any state changes or something?
- What is reasonable output?
- And the last: I got this warning and didn't find out what's wrong:
---
manifest.cc:100: warning: passing `const manifest_map' as `this'
argument of `
_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&)
[with
_Key = file_path, _Tp = file_id, _Compare = std::less<file_path>,
_Alloc =
std::__allocator<manifest_map_entry, std::__single_client_alloc>]'
discards
qualifiers
---
Best,
Hans
# Old manifest: f53e2f68bb7f9bcf363415a6b12c86ff1473b795
# New manifest: 9919f400d68d119c6b64e2e89c0c6106886e95ac
# Summary of changes:
#
# patch commands.cc
# from 280e3089762a3483c38012c18af0a9cd288b736b
# to ef164f1d54180d73753cb99c826e35dc25794e32
#
# patch manifest.cc
# from bf15f253f53eef03ef0996eb7e493df3f4c36252
# to 3c635ddcb4cb334ad3e357ba415f13eb4a66562a
#
# patch manifest.hh
# from fe1a236589283e6774e6ea301a776e07bf9c36ab
# to 1ed1876a7be1f3ec62caa38f74ae7a1deaba014a
#
--- commands.cc
+++ commands.cc
@@ -336,7 +336,7 @@
L(F("renaming %d files in manifest\n") %
work.renames.size());
apply_work_set(work, paths);
- build_manifest_map(paths, m_new, app);
+ build_manifest_map(paths, m_new, m_old, app);
renames = work.renames;
}
--- manifest.cc
+++ manifest.cc
@@ -81,15 +81,35 @@
void
build_manifest_map(path_set const & paths,
- manifest_map & man,
+ manifest_map & man, manifest_map const & m_old,
app_state & app)
{
man.clear();
for (path_set::const_iterator i = paths.begin();
i != paths.end(); ++i)
{
- N(fs::exists(mkpath((*i)())),
- F("file disappeared but exists in manifest: %s") % (*i)());
+ if(false) // FIXME: Check if inside update cmd
+ {
+ N(fs::exists(mkpath((*i)())),
+ F("file disappeared but exists in manifest: %s") % (*i)());
+ }
+ else
+ {
+ if(!fs::exists(mkpath((*i)()))) // Below exists in checkout cmd too
+ {
+ path_id_pair pip(entry(*i,m_old[*i]));
+
+ N(app.db.file_version_exists(pip.ident()),
+ F("no file version %s found in database for %s")
+ % pip.ident() % pip.path());
+
+ file_data dat;
+ W(F("replacing deleted file %s with %s\n") %
+ pip.path() % pip.ident());
+ app.db.get_file_version(pip.ident(), dat);
+ write_localized_data(pip.path(), dat.inner(), app.lua);
+ }
+ }
hexenc<id> ident;
calculate_ident(*i, ident, app.lua);
man.insert(entry(*i, file_id(ident)));
--- manifest.hh
+++ manifest.hh
@@ -99,8 +99,8 @@
manifest_map & man);
void build_manifest_map(path_set const & paths,
- manifest_map & man,
- app_state & app);
+ manifest_map & man, manifest_map const & m_old,
+ app_state & app);
void append_manifest_map(manifest_map const & m1,
manifest_map & m2);
- [Monotone-devel] Update replacing deleted files,
Hans Fuchs <=
- RE: [Monotone-devel] Update replacing deleted files, Nathaniel Smith, 2004/08/16
- [Monotone-devel] Re: Update replacing deleted files, Hans Fuchs, 2004/08/16
- [Monotone-devel] Re: Update replacing deleted files, Bruce Stephens, 2004/08/16
- [Monotone-devel] Re: Update replacing deleted files, graydon hoare, 2004/08/16
- [Monotone-devel] Re: Update replacing deleted files, Bruce Stephens, 2004/08/16
- [Monotone-devel] Re: Update replacing deleted files, Hans Fuchs, 2004/08/16
- RE: [Monotone-devel] Re: Update replacing deleted files, Eric Meyer, 2004/08/16