Mercurial > hg > hg-fastimport
annotate hgext3rd/fastimport/hgechoprocessor.py @ 89:e6602cc471d5
Use vendor/python_fastimport rather than depending on the library
This is now quite important as upstream dropped support for Python-2
which some hg-fastimport users might still need.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Tue, 19 Jan 2021 23:00:57 +0000 |
| parents | 59a9e4d0aa72 |
| children | efe678b023d3 |
| rev | line source |
|---|---|
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
1 # Copyright (C) 2008 Canonical Ltd |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
2 # |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
3 # This program is free software; you can redistribute it and/or modify |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
4 # it under the terms of the GNU General Public License as published by |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
5 # the Free Software Foundation; either version 2 of the License, or |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
6 # (at your option) any later version. |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
7 # |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
8 # This program is distributed in the hope that it will be useful, |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
11 # GNU General Public License for more details. |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
12 # |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
13 # You should have received a copy of the GNU General Public License |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
14 # along with this program; if not, write to the Free Software |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
16 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
17 """Processor of import commands. |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
18 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
19 This module provides core processing functionality including an abstract class |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
20 for basing real processors on. See the processors package for examples. |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
21 """ |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
22 |
|
89
e6602cc471d5
Use vendor/python_fastimport rather than depending on the library
Roy Marples <roy@marples.name>
parents:
79
diff
changeset
|
23 from .vendor.python_fastimport import processor |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
24 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
25 class HgEchoProcessor(processor.ImportProcessor): |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
26 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
27 def __init__(self, ui, repo, **opts): |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
28 self.ui = ui |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
29 self.repo = repo |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
30 self.opts = opts |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
31 self.finished = False |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
32 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
33 def progress_handler(self, cmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
34 self.ui.write(cmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
35 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
36 def blob_handler(self, cmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
37 self.ui.write(cmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
38 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
39 def checkpoint_handler(self, cmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
40 self.ui.write(cmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
41 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
42 def commit_handler(self, cmd): |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
43 commit_handler = HgEchoCommitHandler(cmd, self.ui, self.repo, **self.opts) |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
44 commit_handler.process() |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
45 self.ui.write(cmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
46 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
47 def reset_handler(self, cmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
48 self.ui.write(cmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
49 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
50 def tag_handler(self, cmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
51 self.ui.write(cmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
52 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
53 class HgEchoCommitHandler(processor.CommitHandler): |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
54 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
55 def __init__(self, command, ui, repo, **opts): |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
56 self.command = command |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
57 self.ui = ui |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
58 self.repo = repo |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
59 self.opts = opts |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
60 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
61 def modify_handler(self, filecmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
62 self.ui.write(filecmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
63 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
64 def delete_handler(self, filecmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
65 self.ui.write(filecmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
66 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
67 def copy_handler(self, filecmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
68 self.ui.write(filecmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
69 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
70 def rename_handler(self, filecmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
71 self.ui.write(filecmd.dump_str(verbose=True) + "\n") |
|
0
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
72 |
|
d107c6d36780
Add the start of the hg fastimport command
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
73 def deleteall_handler(self, filecmd): |
|
1
9461f5c3a67c
Actually imports something - incredible!
Paul Crowley <paul@lshift.net>
parents:
0
diff
changeset
|
74 self.ui.write(filecmd.dump_str(verbose=True) + "\n") |
