[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] listing unknown directories
From: |
Derek Scherger |
Subject: |
[Monotone-devel] listing unknown directories |
Date: |
Sat, 25 Nov 2006 21:48:34 -0700 |
User-agent: |
Thunderbird 1.5.0.8 (X11/20061111) |
Does it make sense to anyone that 'mtn ls unknown' lists the entire tree
below an unknown directory?
I keep a very small part of my home directories in monotone and mtn ls
unknown takes a very long time to run, and produces volumes of output,
mainly because it's listing everything in and below all the unknown
directories. It seems to me that, in this case at least, it might be
better to list just the unknown directories and to not recurse into them
to see what they contain.
Attached is a patch that changes things so that ls unknown does not
recurse into unknown directories and only lists the directories. This
also changes the behavior of 'mtn ls ignored' similarly as it uses
pretty much the same code).
I'm sure there are possible down-sides to this change. For example it
changes the semantics of things like 'mtn ls unknown | mtn xargs add'
and 'mtn add --unknown'. However, add recently became non-recursive and
I wonder if this makes more sense with that change anyway.
Cheers,
Derek
#
# old_revision [ba58032764d77f0d6dccc4f4595b8bac1d4e53d8]
#
# patch "file_io.cc"
# from [c1a8f81e48421f44efef7c5cc3734f8d67509281]
# to [3934d2c5e9b4ca62b58afcb7cfc4cbf0a15d5cdc]
#
# patch "file_io.hh"
# from [53777cabb1b517c78add6314e6f903087d93cdd2]
# to [79d52c5972240f13592b8690bf66e2f0f3029548]
#
# patch "work.cc"
# from [95c5685d05ca64884882a7653f75a0bbff65f587]
# to [f6c2b714c76912e128ca5067979c922701df7f7c]
#
============================================================
--- file_io.cc c1a8f81e48421f44efef7c5cc3734f8d67509281
+++ file_io.cc 3934d2c5e9b4ca62b58afcb7cfc4cbf0a15d5cdc
@@ -501,14 +501,15 @@ walk_tree_recursive(fs::path const & abs
file_path p;
if (!try_file_pathize(rel_entry, p))
continue;
- walker.visit_dir(p);
- walk_tree_recursive(entry, rel_entry, walker);
+ if (walker.visit_dir(p))
+ walk_tree_recursive(entry, rel_entry, walker);
}
}
-void
+bool
tree_walker::visit_dir(file_path const & path)
{
+ return true;
}
@@ -534,10 +535,10 @@ walk_tree(file_path const & path,
walker.visit_file(path);
break;
case path::directory:
- walker.visit_dir(path);
- walk_tree_recursive(system_path(path).as_external(),
- path.as_external(),
- walker);
+ if (walker.visit_dir(path))
+ walk_tree_recursive(system_path(path).as_external(),
+ path.as_external(),
+ walker);
break;
}
}
============================================================
--- file_io.hh 53777cabb1b517c78add6314e6f903087d93cdd2
+++ file_io.hh 79d52c5972240f13592b8690bf66e2f0f3029548
@@ -94,7 +94,7 @@ public:
{
public:
// returns true if the directory should be descended into
- virtual void visit_dir(file_path const & path);
+ virtual bool visit_dir(file_path const & path);
virtual void visit_file(file_path const & path) = 0;
virtual ~tree_walker();
};
============================================================
--- work.cc 95c5685d05ca64884882a7653f75a0bbff65f587
+++ work.cc f6c2b714c76912e128ca5067979c922701df7f7c
@@ -446,14 +446,18 @@ struct file_itemizer : public tree_walke
path_set & k, path_set & u, path_set & i,
path_restriction const & r)
: db(db), lua(lua), known(k), unknown(u), ignored(i), mask(r) {}
- virtual void visit_dir(file_path const & path);
+ virtual bool visit_dir(file_path const & path);
virtual void visit_file(file_path const & path);
};
-void
+bool
file_itemizer::visit_dir(file_path const & path)
{
this->visit_file(path);
+
+ split_path sp;
+ path.split(sp);
+ return known.find(sp) != known.end();
}
void
@@ -486,7 +490,7 @@ public:
bool i = true)
: db(db), lua(lua), ros(r), er(e), respect_ignore(i)
{}
- virtual void visit_dir(file_path const & path);
+ virtual bool visit_dir(file_path const & path);
virtual void visit_file(file_path const & path);
void add_node_for(split_path const & sp);
};
@@ -527,10 +531,11 @@ addition_builder::add_node_for(split_pat
}
-void
+bool
addition_builder::visit_dir(file_path const & path)
{
this->visit_file(path);
+ return true;
}
void
- [Monotone-devel] listing unknown directories,
Derek Scherger <=
- Re: [Monotone-devel] listing unknown directories, Brian May, 2006/11/26
- [Monotone-devel] Re: listing unknown directories, Bruce Stephens, 2006/11/26
- Re: [Monotone-devel] Re: listing unknown directories, Johan Bolmsjö, 2006/11/27
- Re: [Monotone-devel] Re: listing unknown directories, Derek Scherger, 2006/11/29
- Re: [Monotone-devel] Re: listing unknown directories, Thomas Moschny, 2006/11/29
- Re: [Monotone-devel] Re: listing unknown directories, Nathaniel Smith, 2006/11/29
- Re: [Monotone-devel] Re: listing unknown directories, Brian May, 2006/11/29
- Re: [Monotone-devel] Re: listing unknown directories, Zbynek Winkler, 2006/11/29
- Re: [Monotone-devel] Re: listing unknown directories, hendrik, 2006/11/29
- Re: [Monotone-devel] Re: listing unknown directories, Thomas Moschny, 2006/11/29