|
1 | 1 | #!/usr/bin/env python
|
2 | 2 |
|
3 |
| -# It would be nice if we could just |
4 |
| -# import git_repo_filter |
5 |
| -# but that'd require renaming git-filter-repo to git_repo_filter.py, which would |
6 |
| -# be detrimental to its predominant usage as a tool rather than a library. So, |
7 |
| -# we use the next five lines instead. |
8 |
| -import imp |
9 |
| -import sys |
10 |
| -sys.dont_write_bytecode = True # .pyc generation -> ugly 'git-filter-repoc' files |
11 |
| -with open("../../../git-filter-repo") as f: |
12 |
| - repo_filter = imp.load_source('repo_filter', "git-filter-repo", f) |
13 |
| -# End of import workaround |
14 |
| -from repo_filter import Blob, Reset, FileChanges, Commit, Tag, FixedTimeZone |
15 |
| -from repo_filter import Progress, Checkpoint |
| 3 | +import git_filter_repo as fr |
| 4 | +from git_filter_repo import Blob, Reset, FileChanges, Commit, Tag, FixedTimeZone |
| 5 | +from git_filter_repo import Progress, Checkpoint |
16 | 6 |
|
17 | 7 | from datetime import datetime, timedelta
|
18 | 8 |
|
19 |
| -args = repo_filter.FilteringOptions.default_options() |
20 |
| -out = repo_filter.RepoFilter(args) |
| 9 | +args = fr.FilteringOptions.default_options() |
| 10 | +out = fr.RepoFilter(args) |
21 | 11 | out.importer_only()
|
22 | 12 |
|
23 | 13 | output = out._output
|
|
36 | 26 | when = datetime(year=2005, month=4, day=7,
|
37 | 27 | hour=15, minute=16, second=10,
|
38 | 28 | tzinfo=FixedTimeZone("-0700"))
|
39 |
| -when_string = repo_filter.date_to_string(when) |
| 29 | +when_string = fr.date_to_string(when) |
40 | 30 | commit1 = Commit("refs/heads/master",
|
41 | 31 | "A U Thor", "[email protected]", when_string,
|
42 | 32 | "Com M. Iter", "[email protected]", when_string,
|
|
54 | 44 | changes = [FileChanges('M', 'world', world.id, mode="100644"),
|
55 | 45 | FileChanges('M', 'planet', world_link.id, mode="120000")]
|
56 | 46 | when += timedelta(days=3, hours=4, minutes=6)
|
57 |
| -when_string = repo_filter.date_to_string(when) |
| 47 | +when_string = fr.date_to_string(when) |
58 | 48 | commit2 = Commit("refs/heads/master",
|
59 | 49 | "A U Thor", "[email protected]", when_string,
|
60 | 50 | "Com M. Iter", "[email protected]", when_string,
|
|
91 | 81 |
|
92 | 82 | changes = [FileChanges('M', 'world', world.id, mode="100644")]
|
93 | 83 | when = datetime(2006, 8, 17, tzinfo=FixedTimeZone("+0200"))
|
94 |
| -when_string = repo_filter.date_to_string(when) |
| 84 | +when_string = fr.date_to_string(when) |
95 | 85 | commit4 = Commit("refs/heads/devel",
|
96 | 86 | "A U Thor", "[email protected]", when_string,
|
97 | 87 | "Com M. Iter", "[email protected]", when_string,
|
|
103 | 93 |
|
104 | 94 | world = Blob("Hello\nHi\nGoodbye")
|
105 | 95 | world.dump(output)
|
106 |
| -when = repo_filter.string_to_date(commit3.author_date) + timedelta(days=47) |
107 |
| -when_string = repo_filter.date_to_string(when) |
| 96 | +when = fr.string_to_date(commit3.author_date) + timedelta(days=47) |
| 97 | +when_string = fr.date_to_string(when) |
108 | 98 | # git fast-import requires file changes to be listed in terms of differences
|
109 | 99 | # to the first parent. Thus, despite the fact that runme and planet have
|
110 | 100 | # not changed and bar was not modified in the devel side, we have to list them
|
|
0 commit comments