Mercurial > hg-git
changeset 821:53e7e8f34dcd
git_handler: introduce a function and config to filter by minimum date
This is useful if there's no desire to import old Git branches, but new ones
should be.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 29 Oct 2014 19:36:33 -0700 |
parents | 0d6d2fcc62b6 |
children | c29eaba651d7 |
files | hggit/git_handler.py |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py Fri Oct 31 11:14:35 2014 -0700 +++ b/hggit/git_handler.py Wed Oct 29 19:36:33 2014 -0700 @@ -1082,6 +1082,19 @@ # returned return util.OrderedDict((r, refs[r]) for r in filteredrefs) + def filter_min_date(self, refs): + '''filter refs by minimum date + + This only works for refs that are available locally.''' + min_date = self.ui.config('git', 'mindate') + if min_date is None: + return refs + + # filter refs older than min_timestamp + min_timestamp, min_offset = hgutil.parsedate(min_date) + return util.OrderedDict((ref, sha) for ref, sha in refs.iteritems() + if self.git[sha].commit_time >= min_timestamp) + def update_references(self): exportable = self.get_exportable()