git-remote-hg 1.0.2.1__tar.gz → 1.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,339 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
@@ -1,20 +1,12 @@
1
- Metadata-Version: 1.1
1
+ Metadata-Version: 2.4
2
2
  Name: git-remote-hg
3
- Version: 1.0.2.1
3
+ Version: 1.0.5
4
4
  Summary: access hg repositories as git remotes
5
5
  Home-page: http://github.com/mnauw/git-remote-hg
6
6
  Author: Mark Nauwelaerts
7
7
  Author-email: mnauw@users.sourceforge.net
8
8
  License: GPLv2
9
- Description:
10
- 'git-remote-hg' is a gitremote protocol helper for Mercurial.
11
- It allows you to clone, fetch and push to and from Mercurial repositories as if
12
- they were Git ones using a hg::some-url URL.
13
-
14
- See the homepage for much more explanation.
15
-
16
9
  Keywords: git hg mercurial
17
- Platform: UNKNOWN
18
10
  Classifier: Programming Language :: Python
19
11
  Classifier: Programming Language :: Python :: 2
20
12
  Classifier: Programming Language :: Python :: 2.7
@@ -24,3 +16,20 @@ Classifier: License :: OSI Approved
24
16
  Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
25
17
  Classifier: Development Status :: 5 - Production/Stable
26
18
  Classifier: Intended Audience :: Developers
19
+ License-File: LICENSE
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: home-page
25
+ Dynamic: keywords
26
+ Dynamic: license
27
+ Dynamic: license-file
28
+ Dynamic: summary
29
+
30
+
31
+ 'git-remote-hg' is a gitremote protocol helper for Mercurial.
32
+ It allows you to clone, fetch and push to and from Mercurial repositories as if
33
+ they were Git ones using a hg::some-url URL.
34
+
35
+ See the homepage for much more explanation.
@@ -5,6 +5,11 @@
5
5
 
6
6
  from mercurial import hg, ui, commands, util
7
7
  from mercurial import context, subrepo
8
+ try:
9
+ # hg >= 5.8
10
+ from mercurial.utils import urlutil
11
+ except ImportError:
12
+ from mercurial import util as urlutil
8
13
 
9
14
  import re
10
15
  import sys
@@ -51,7 +56,13 @@ if sys.version_info[0] == 3:
51
56
  stdout = sys.stdout.buffer
52
57
  stderr = sys.stderr.buffer
53
58
  getcwd = os.getcwdb
54
- getenv = os.getenvb if os.supports_bytes_environ else os.getenv
59
+ @staticmethod
60
+ def getenvb(val, default):
61
+ result = os.getenv(val.decode(), default.decode() if hasattr(default, 'decode') else default)
62
+ # if result is a string, get bytes instead
63
+ result = result.encode() if hasattr(result, 'encode') else result
64
+ return result
65
+ getenv = os.getenvb if os.supports_bytes_environ else getenvb
55
66
  else:
56
67
  class compat(basecompat):
57
68
  # life was simple in those days ...
@@ -86,11 +97,27 @@ def debug(msg, *args):
86
97
  def log(msg, *args):
87
98
  logger.log(logging.LOG, msg, *args)
88
99
 
100
+ # new style way to import a source file
101
+ def _imp_load_source(module_name, file_path):
102
+ import importlib.util
103
+ loader = importlib.machinery.SourceFileLoader(module_name, file_path)
104
+ spec = importlib.util.spec_from_loader(module_name, loader)
105
+ module = importlib.util.module_from_spec(spec)
106
+ sys.modules[module_name] = module
107
+ spec.loader.exec_module(module)
108
+ return module
109
+
89
110
  def import_sibling(mod, filename):
90
- import imp
91
111
  mydir = os.path.dirname(__file__)
92
112
  sys.dont_write_bytecode = True
93
- return imp.load_source(mod, os.path.join(mydir, filename))
113
+ vi = sys.version_info
114
+ ff = os.path.join(mydir, filename)
115
+ if vi.major >= 3 and vi.minor >= 5:
116
+ return _imp_load_source(mod, ff)
117
+ else:
118
+ import imp
119
+ return imp.load_source(mod, ff)
120
+
94
121
 
95
122
  class GitHgRepo:
96
123
 
@@ -135,7 +162,7 @@ class GitHgRepo:
135
162
  process = self.start_cmd(args, **kwargs)
136
163
  output = process.communicate()[0]
137
164
  if check and process.returncode != 0:
138
- die(b'command failed: %s' % b' '.join([compat.to_b(a) for a in cmd]))
165
+ die(b'git command failed: %s' % b' '.join([compat.to_b(a) for a in args]))
139
166
  return output
140
167
 
141
168
  def get_config(self, config, getall=False):
@@ -216,9 +243,12 @@ class GitHgRepo:
216
243
  warn(b'failed to find local hg for remote %s' % (r))
217
244
  continue
218
245
  else:
246
+ npath = os.path.abspath(hg_path)
247
+ # use relative path if possible
248
+ if check_version(4, 2):
249
+ npath = os.path.join(b'..', b'..', b'..', b'.hg')
219
250
  # make sure the shared path is always up-to-date
220
- util.writefile(os.path.join(local_hg, b'sharedpath'),
221
- os.path.abspath(hg_path))
251
+ util.writefile(os.path.join(local_hg, b'sharedpath'), npath)
222
252
  self.hg_repos[r] = os.path.join(local_path)
223
253
 
224
254
  log('%s determined hg_repos %s', self.identity(), self.hg_repos)
@@ -308,11 +338,11 @@ class GitHgRepo:
308
338
  if not kind in (b'hg', b'git'):
309
339
  warn('skipping unsupported subrepo type %s' % kind)
310
340
  continue
311
- if not util.url(src).isabs():
341
+ if not urlutil.url(src).isabs():
312
342
  parent = self.get_hg_repo_url(remote)
313
343
  if not parent:
314
344
  die(b'could not determine repo url of %s' % remote)
315
- parent = util.url(parent)
345
+ parent = urlutil.url(parent)
316
346
  parent.path = posixpath.join(parent.path or b'', src)
317
347
  parent.path = posixpath.normpath(parent.path)
318
348
  src = bytes(parent)
@@ -544,6 +574,43 @@ class GcCommand(SubCommand):
544
574
  gm.store()
545
575
 
546
576
 
577
+ class MapFileCommand(SubCommand):
578
+
579
+ def argumentparser(self):
580
+ usage = '%%(prog)s %s [options] <remote>' % (self.subcommand)
581
+ p = argparse.ArgumentParser(usage=usage)
582
+ p.add_argument('--output', required=True,
583
+ help='mapfile to write')
584
+ p.epilog = textwrap.dedent("""\
585
+ Writes a so-called git-mapfile, as used internally by hg-git.
586
+ This files consists of lines of format `<githexsha> <hghexsha>`.
587
+
588
+ As such, the result could be used to coax hg-git in some manner.
589
+ However, as git-remote-hg and hg-git may (likely) produce different
590
+ commits (either git or hg), mixed use of both tools is not recommended.
591
+ """)
592
+ return p
593
+
594
+ def do(self, options, args):
595
+ remotehg = import_sibling('remotehg', 'git-remote-hg')
596
+
597
+ if not args or len(args) != 1:
598
+ self.usage('expect 1 remote')
599
+
600
+ remote = args[0]
601
+ hgpath = remotehg.select_marks_dir(remote, self.githgrepo.gitdir, False)
602
+ puts(b"Loading hg marks ...")
603
+ hgm = remotehg.Marks(os.path.join(hgpath, b'marks-hg'), None)
604
+ puts(b"Loading git marks ...")
605
+ gm = GitMarks(os.path.join(hgpath, b'marks-git'))
606
+ puts(b"Writing mapfile ...")
607
+ with open(options.output, 'wb') as f:
608
+ for c, m in gm.marks.items():
609
+ hgc = hgm.rev_marks.get(m, None)
610
+ if hgc:
611
+ f.write(b'%s %s\n' % (c, hgc))
612
+
613
+
547
614
  class SubRepoCommand(SubCommand):
548
615
 
549
616
  def writestate(repo, state):
@@ -910,6 +977,7 @@ def get_subcommands():
910
977
  b'repo': RepoCommand,
911
978
  b'gc': GcCommand,
912
979
  b'sub': SubRepoCommand,
980
+ b'mapfile': MapFileCommand,
913
981
  b'help' : HelpCommand
914
982
  }
915
983
  # add remote named subcommands
@@ -932,6 +1000,7 @@ def do_usage():
932
1000
  gc \t perform maintenance and consistency cleanup on repo tracking marks
933
1001
  sub \t manage subrepos
934
1002
  repo \t show local hg repo backing a remote
1003
+ mapfile \t dump a hg-git git-mapfile
935
1004
 
936
1005
  If the subcommand is the name of a remote hg repo, then any remaining arguments
937
1006
  are considered a "hg command", e.g. hg heads, or thg, and it is then executed
@@ -86,7 +86,13 @@ if sys.version_info[0] == 3:
86
86
  stdout = sys.stdout.buffer
87
87
  stderr = sys.stderr.buffer
88
88
  getcwd = os.getcwdb
89
- getenv = os.getenvb if os.supports_bytes_environ else os.getenv
89
+ @staticmethod
90
+ def getenvb(val, default):
91
+ result = os.getenv(val.decode(), default.decode() if hasattr(default, 'decode') else default)
92
+ # if result is a string, get bytes instead
93
+ result = result.encode() if hasattr(result, 'encode') else result
94
+ return result
95
+ getenv = os.getenvb if os.supports_bytes_environ else getenvb
90
96
  urlparse = urllib.parse.urlparse
91
97
  urljoin = urllib.parse.urljoin
92
98
  else:
@@ -116,6 +122,27 @@ else:
116
122
  urlparse = staticmethod(_urlparse)
117
123
  urljoin = staticmethod(_urljoin)
118
124
 
125
+ # new style way to import a source file
126
+ def _imp_load_source(module_name, file_path):
127
+ import importlib.util
128
+ loader = importlib.machinery.SourceFileLoader(module_name, file_path)
129
+ spec = importlib.util.spec_from_loader(module_name, loader)
130
+ module = importlib.util.module_from_spec(spec)
131
+ sys.modules[module_name] = module
132
+ spec.loader.exec_module(module)
133
+ return module
134
+
135
+ def import_sibling(mod, filename):
136
+ mydir = os.path.dirname(__file__)
137
+ sys.dont_write_bytecode = True
138
+ vi = sys.version_info
139
+ ff = os.path.join(mydir, filename)
140
+ if vi.major >= 3 and vi.minor >= 5:
141
+ return _imp_load_source(mod, ff)
142
+ else:
143
+ import imp
144
+ return imp.load_source(mod, ff)
145
+
119
146
  #
120
147
  # If you want to see Mercurial revisions as Git commit notes:
121
148
  # git config core.notesRef refs/notes/hg
@@ -141,11 +168,11 @@ else:
141
168
  # Commits are modified to preserve hg information and allow bidirectionality.
142
169
  #
143
170
 
144
- NAME_RE = re.compile(b'^([^<>]+)')
145
- AUTHOR_RE = re.compile(b'^([^<>]+?)? ?[<>]([^<>]*)(?:$|>)')
171
+ NAME_RE = re.compile(br'^([^<>]+)')
172
+ AUTHOR_RE = re.compile(br'^([^<>]+?)? ?[<>]([^<>]*)(?:$|>)')
146
173
  EMAIL_RE = re.compile(br'([^ \t<>]+@[^ \t<>]+)')
147
- AUTHOR_HG_RE = re.compile(b'^(.*?) ?<(.*?)(?:>(.*))?$')
148
- RAW_AUTHOR_RE = re.compile(b'^(\w+) (?:(.+)? )?<(.*)> (\d+) ([+-]\d+)')
174
+ AUTHOR_HG_RE = re.compile(br'^(.*?) ?<(.*?)(?:>(.*))?$')
175
+ RAW_AUTHOR_RE = re.compile(br'^(\w+) (?:(.+)? )?<(.*)> (\d+) ([+-]\d+)')
149
176
 
150
177
  VERSION = 2
151
178
 
@@ -153,6 +180,9 @@ def die(msg):
153
180
  compat.stderr.write(b'ERROR: %s\n' % compat.to_b(msg, 'utf-8'))
154
181
  sys.exit(1)
155
182
 
183
+ def debug(*args):
184
+ compat.stderr.write(b'DEBUG: %s\n' % compat.to_b(repr(args)))
185
+
156
186
  def warn(msg):
157
187
  compat.stderr.write(b'WARNING: %s\n' % compat.to_b(msg, 'utf-8'))
158
188
  compat.stderr.flush()
@@ -193,7 +223,9 @@ def gitref(ref):
193
223
  # standard url percentage encoding with a (legacy) twist:
194
224
  # ' ' -> '___'
195
225
  # '___' also percentage encoded
196
- return compat.urlquote(ref).replace(b'___', b'%5F%5F%5F').replace(b'%20', b'___')
226
+ # python 3.6 considers ~ reserved, whereas python 3.7 no longer
227
+ return compat.urlquote(ref).replace(b'___', b'%5F%5F%5F'). \
228
+ replace(b'%20', b'___').replace(b'~', b'%7E')
197
229
 
198
230
  def check_version(*check):
199
231
  if not hg_version:
@@ -229,27 +261,17 @@ def get_rev_hg(commit):
229
261
 
230
262
  class Marks:
231
263
 
232
- def __init__(self, path, repo):
264
+ def __init__(self, path, _repo=None):
233
265
  self.path = path
234
- self.repo = repo
235
266
  self.clear()
236
267
  self.load()
237
268
 
238
- if self.version < VERSION:
239
- if self.version == 1:
240
- self.upgrade_one()
241
-
242
- # upgraded?
243
- if self.version < VERSION:
244
- self.clear()
245
- self.version = VERSION
246
-
247
269
  def clear(self):
248
270
  self.tips = {}
249
271
  self.marks = {}
250
272
  self.rev_marks = {}
251
273
  self.last_mark = 0
252
- self.version = 0
274
+ self.version = VERSION
253
275
  self.last_note = 0
254
276
 
255
277
  def load(self):
@@ -265,20 +287,12 @@ class Marks:
265
287
  self.tips = []
266
288
  self.marks = marks
267
289
  self.last_mark = tmp['last-mark']
268
- self.version = tmp.get('version', 1)
290
+ self.version = tmp['version']
269
291
  self.last_note = 0
270
292
 
271
293
  for rev, mark in compat.iteritems(self.marks):
272
294
  self.rev_marks[mark] = rev
273
295
 
274
- def upgrade_one(self):
275
- def get_id(rev):
276
- return hghex(self.repo.changelog.node(int(rev)))
277
- self.tips = dict((name, get_id(rev)) for name, rev in compat.iteritems(self.tips))
278
- self.marks = dict((get_id(rev), mark) for rev, mark in compat.iteritems(self.marks))
279
- self.rev_marks = dict((mark, get_id(rev)) for mark, rev in compat.iteritems(self.rev_marks))
280
- self.version = 2
281
-
282
296
  def dict(self):
283
297
  return { 'tips': self.tips, 'marks': self.marks,
284
298
  'last-mark': self.last_mark, 'version': self.version,
@@ -381,7 +395,7 @@ class Parser:
381
395
  return None
382
396
  _, name, email, date, tz = m.groups()
383
397
  if name and b'ext:' in name:
384
- m = re.match(b'^(.+?) ext:\((.+)\)$', name)
398
+ m = re.match(br'^(.+?) ext:\((.+)\)$', name)
385
399
  if m:
386
400
  name = m.group(1)
387
401
  ex = compat.urlunquote(m.group(2))
@@ -400,40 +414,38 @@ class Parser:
400
414
  return (user, int(date), hgtz(tz))
401
415
 
402
416
  def fix_file_path(path):
403
- def posix_path(path):
404
- if os.sep == '/':
405
- return path
406
- # even Git for Windows expects forward
407
- return path.replace(compat.to_b(os.sep), b'/')
408
- # also converts forward slash to backwards slash on Win
409
417
  path = os.path.normpath(path)
410
- if not os.path.isabs(path):
411
- return posix_path(path)
412
- return posix_path(os.path.relpath(path, b'/'))
413
-
414
- def export_files(files):
415
- final = []
416
- for f in files:
417
- fid = node.hex(f.filenode())
418
-
419
- if fid in filenodes:
420
- mark = filenodes[fid]
421
- else:
422
- mark = marks.next_mark()
423
- filenodes[fid] = mark
424
- d = f.data()
425
-
426
- puts(b"blob")
427
- puts(b"mark :%u" % mark)
428
- puts(b"data %d" % len(d))
429
- puts(d)
418
+ if os.path.isabs(path):
419
+ path = os.path.relpath(path, b'/')
420
+ if os.sep == '/':
421
+ return path
422
+ # even Git for Windows expects forward
423
+ return path.replace(compat.to_b(os.sep), b'/')
424
+
425
+ def export_file(ctx, fname):
426
+ f = ctx.filectx(fname)
427
+ fid = node.hex(f.filenode())
428
+
429
+ if fid in filenodes:
430
+ mark = filenodes[fid]
431
+ else:
432
+ mark = marks.next_mark()
433
+ filenodes[fid] = mark
434
+ d = f.data()
430
435
 
431
- path = fix_file_path(f.path())
432
- final.append((gitmode(f.flags()), mark, path))
436
+ puts(b"blob")
437
+ puts(b"mark :%u" % mark)
438
+ puts(b"data %d" % len(d))
439
+ puts(f.data())
433
440
 
434
- return final
441
+ path = fixup_path_to_git(fix_file_path(f.path()))
442
+ return (gitmode(f.flags()), mark, path)
435
443
 
436
444
  def get_filechanges(repo, ctx, parent):
445
+ if hasattr(parent, 'status'):
446
+ stat = parent.status(ctx)
447
+ return stat.modified + stat.added, stat.removed
448
+
437
449
  modified = set()
438
450
  added = set()
439
451
  removed = set()
@@ -475,7 +487,7 @@ def fixup_user_git(user):
475
487
  def fixup_user_hg(user):
476
488
  def sanitize(name):
477
489
  # stole this from hg-git
478
- return re.sub(b'[<>\n]', b'?', name.lstrip(b'< ').rstrip(b'> '))
490
+ return re.sub(br'[<>\n]', b'?', name.lstrip(b'< ').rstrip(b'> '))
479
491
 
480
492
  m = AUTHOR_HG_RE.match(user)
481
493
  if m:
@@ -506,6 +518,51 @@ def fixup_user(user):
506
518
 
507
519
  return b'%s <%s>' % (name, mail)
508
520
 
521
+ # (recent) git fast-import does not accept .git or .gitmodule component names
522
+ # (anywhere, case-insensitive)
523
+ # in any case, surprising things may happen, so add some front-end replacement magic;
524
+ # transform of (hg) .git(0 or more suffix) to (git) .git(1 or more suffix)
525
+ # (likewise so for any invalid git keyword)
526
+ def fixup_dotfile_path(path, suffix, add):
527
+ def subst(part):
528
+ if (not part) or part[0] != ord(b'.'):
529
+ return part
530
+ for prefix in (b'.git', b'.gitmodules'):
531
+ pl = len(prefix)
532
+ tail = len(part) - pl
533
+ if tail < 0:
534
+ continue
535
+ if part[0:pl].lower() == prefix and part[pl:] == suffix * tail:
536
+ if add:
537
+ return part + suffix
538
+ elif tail == 0:
539
+ # .git should not occur in git space
540
+ # so complain
541
+ if pl == 3:
542
+ die('invalid path component %s' % part)
543
+ else:
544
+ # but .gitmodules might
545
+ # leave as-is, it is handled/ignored elsewhere
546
+ return part
547
+ else:
548
+ return part[0:-1]
549
+ return part
550
+ # quick optimization check;
551
+ if (not path) or (path[0] != ord(b'.') and path.find(b'/.') < 0):
552
+ return path
553
+ sep = b'/'
554
+ return sep.join((subst(part) for part in path.split(sep)))
555
+
556
+ def fixup_path_to_git(path):
557
+ if not dotfile_suffix:
558
+ return path
559
+ return fixup_dotfile_path(path, dotfile_suffix, True)
560
+
561
+ def fixup_path_from_git(path):
562
+ if not dotfile_suffix:
563
+ return path
564
+ return fixup_dotfile_path(path, dotfile_suffix, False)
565
+
509
566
  def updatebookmarks(repo, peer):
510
567
  remotemarks = peer.listkeys(b'bookmarks')
511
568
 
@@ -577,18 +634,6 @@ def get_repo(url, alias):
577
634
  else:
578
635
  shared_path = os.path.join(gitdir, b'hg')
579
636
 
580
- # check and upgrade old organization
581
- hg_path = os.path.join(shared_path, b'.hg')
582
- if os.path.exists(shared_path) and not os.path.exists(hg_path):
583
- repos = os.listdir(shared_path)
584
- for x in repos:
585
- local_hg = os.path.join(shared_path, x, b'clone', b'.hg')
586
- if not os.path.exists(local_hg):
587
- continue
588
- if not os.path.exists(hg_path):
589
- shutil.move(local_hg, hg_path)
590
- shutil.rmtree(os.path.join(shared_path, x, b'clone'))
591
-
592
637
  # setup shared repo (if not there)
593
638
  try:
594
639
  hg.peer(myui, {}, shared_path, create=True)
@@ -599,8 +644,13 @@ def get_repo(url, alias):
599
644
  os.makedirs(dirname)
600
645
 
601
646
  local_path = os.path.join(dirname, b'clone')
647
+ kwargs = {}
648
+ hg_path = os.path.join(shared_path, b'.hg')
649
+ if check_version(4, 2):
650
+ kwargs = {'relative': True}
651
+ hg_path = os.path.join(b'..', b'..', b'..', b'.hg')
602
652
  if not os.path.exists(local_path):
603
- hg.share(myui, shared_path, local_path, update=False)
653
+ hg.share(myui, shared_path, local_path, update=False, **kwargs)
604
654
  else:
605
655
  # make sure the shared path is always up-to-date
606
656
  util.writefile(os.path.join(local_path, b'.hg', b'sharedpath'), hg_path)
@@ -709,11 +759,16 @@ def export_ref(repo, name, kind, head):
709
759
  if rename:
710
760
  renames.append((rename[0], f))
711
761
 
762
+ # NOTE no longer used in hg-git, a HG:rename extra header is used
712
763
  for e in renames:
713
764
  extra_msg += b"rename : %s => %s\n" % e
714
765
 
715
766
  for key, value in compat.iteritems(extra):
716
- if key in (b'author', b'committer', b'encoding', b'message', b'branch', b'hg-git'):
767
+ if key in (b'author', b'committer', b'encoding', b'message', b'branch', b'hg-git', b'transplant_source'):
768
+ continue
769
+ elif key == b'hg-git-rename-source' and value == b'git':
770
+ # extra data that hg-git might put there unconditionally
771
+ # or that we put in there to be compatible
717
772
  continue
718
773
  else:
719
774
  extra_msg += b"extra : %s : %s\n" % (key, compat.urlquote(value))
@@ -724,7 +779,7 @@ def export_ref(repo, name, kind, head):
724
779
  if len(parents) == 0:
725
780
  puts(b'reset %s/%s' % (prefix, ename))
726
781
 
727
- modified_final = export_files(c.filectx(f) for f in modified)
782
+ modified_final = [export_file(c, fname) for fname in modified]
728
783
 
729
784
  puts(b"commit %s/%s" % (prefix, ename))
730
785
  puts(b"mark :%d" % (marks.get_mark(c.hex())))
@@ -739,7 +794,7 @@ def export_ref(repo, name, kind, head):
739
794
  puts(b"merge :%u" % (rev_to_mark(parents[1])))
740
795
 
741
796
  for f in removed:
742
- puts(b"D %s" % (fix_file_path(f)))
797
+ puts(b"D %s" % fixup_path_to_git(fix_file_path(f)))
743
798
  for f in modified_final:
744
799
  puts(b"M %s :%u %s" % f)
745
800
  puts()
@@ -837,8 +892,11 @@ def do_list(parser, branchmap):
837
892
 
838
893
  for branch, heads in compat.iteritems(branchmap):
839
894
  # only open heads
840
- heads = [h for h in heads if b'close' not in repo.changelog.read(h)[5]]
841
- if heads:
895
+ try:
896
+ heads = [h for h in heads if b'close' not in repo.changelog.read(h)[5]]
897
+ if heads:
898
+ branches[branch] = heads
899
+ except error.LookupError:
842
900
  branches[branch] = heads
843
901
 
844
902
  list_head(repo, cur)
@@ -1029,6 +1087,7 @@ def parse_commit(parser):
1029
1087
  else:
1030
1088
  die(b'Unknown file command: %s' % line)
1031
1089
  path = c_style_unescape(path)
1090
+ path = fixup_path_from_git(path)
1032
1091
  files[path] = files.get(path, {})
1033
1092
  files[path].update(f)
1034
1093
 
@@ -1133,10 +1192,20 @@ def parse_commit(parser):
1133
1192
  extra[b'branch'] = hgref(branch)
1134
1193
 
1135
1194
  if mode == 'hg':
1195
+ # add some extra that hg-git adds (almost) unconditionally
1196
+ # see also https://foss.heptapod.net/mercurial/hg-git/-/merge_requests/211
1197
+ # NOTE it could be changed to another value below
1198
+ # actually, it is *almost* unconditionally, and only done if the commit
1199
+ # is deduced to originate in git. However, the latter is based on
1200
+ # presence/absence of HG markers in commit "extra headers".
1201
+ # The latter can not be handled here, and so this can not be correctly
1202
+ # reproduced.
1203
+ # extra[b'hg-git-rename-source'] = b'git'
1136
1204
  i = data.find(b'\n--HG--\n')
1137
1205
  if i >= 0:
1138
1206
  tmp = data[i + len(b'\n--HG--\n'):].strip()
1139
1207
  for k, v in [e.split(b' : ', 1) for e in tmp.split(b'\n')]:
1208
+ # NOTE no longer used in hg-git, a HG:rename extra header is used
1140
1209
  if k == b'rename':
1141
1210
  old, new = v.split(b' => ', 1)
1142
1211
  files[new]['rename'] = old
@@ -1324,7 +1393,10 @@ def checkheads(repo, remote, p_revs, force):
1324
1393
  def push_unsafe(repo, remote, p_revs, force):
1325
1394
 
1326
1395
  fci = discovery.findcommonincoming
1327
- commoninc = fci(repo, remote, force=force)
1396
+ if check_version(4, 5):
1397
+ commoninc = fci(repo, remote, force=force, ancestorsof=list(p_revs))
1398
+ else:
1399
+ commoninc = fci(repo, remote, force=force)
1328
1400
  common, _, remoteheads = commoninc
1329
1401
  fco = discovery.findcommonoutgoing
1330
1402
  outgoing = fco(repo, remote, onlyheads=list(p_revs), commoninc=commoninc, force=force)
@@ -1355,12 +1427,6 @@ def push_unsafe(repo, remote, p_revs, force):
1355
1427
  else:
1356
1428
  ret = remote.addchangegroup(cg, b'push', repo.url())
1357
1429
 
1358
- phases = remote.listkeys(b'phases')
1359
- if phases:
1360
- for head in p_revs:
1361
- # update to public
1362
- remote.pushkey(b'phases', hghex(head), b'1', b'0')
1363
-
1364
1430
  return ret
1365
1431
 
1366
1432
  def push(repo, remote, p_revs, force):
@@ -1395,6 +1461,7 @@ def do_push_hg(parser):
1395
1461
  global parsed_refs, parsed_tags
1396
1462
  p_bmarks = []
1397
1463
  p_revs = {}
1464
+ ok_refs = []
1398
1465
 
1399
1466
  parsed_refs = {}
1400
1467
  parsed_tags = {}
@@ -1441,7 +1508,7 @@ def do_push_hg(parser):
1441
1508
  continue
1442
1509
 
1443
1510
  p_revs[bnode] = ref
1444
- puts(b"ok %s" % ref)
1511
+ ok_refs.append(ref)
1445
1512
  elif ref.startswith(b'refs/heads/'):
1446
1513
  bmark = ref[len(b'refs/heads/'):]
1447
1514
  new = node
@@ -1451,14 +1518,14 @@ def do_push_hg(parser):
1451
1518
  puts(b"ok %s up to date" % ref)
1452
1519
  continue
1453
1520
 
1454
- puts(b"ok %s" % ref)
1521
+ ok_refs.append(ref)
1455
1522
  if not bookmark_is_fake(bmark, parser.repo._bookmarks):
1456
1523
  p_bmarks.append((ref, bmark, old, new))
1457
1524
 
1458
1525
  p_revs[bnode] = ref
1459
1526
  elif ref.startswith(b'refs/tags/'):
1460
1527
  if dry_run:
1461
- puts(b"ok %s" % ref)
1528
+ ok_refs.append(ref)
1462
1529
  continue
1463
1530
  tag = ref[len(b'refs/tags/'):]
1464
1531
  tag = hgref(tag)
@@ -1485,14 +1552,15 @@ def do_push_hg(parser):
1485
1552
  fp.write(b'%s %s\n' % (node, tag))
1486
1553
  fp.close()
1487
1554
  p_revs[bnode] = ref
1488
- puts(b"ok %s" % ref)
1555
+ ok_refs.append(ref)
1489
1556
  else:
1490
1557
  # transport-helper/fast-export bugs
1491
1558
  continue
1492
1559
 
1493
1560
  if dry_run:
1494
- if peer:
1495
- checkheads(parser.repo, peer, p_revs, force_push)
1561
+ if not peer or checkheads(parser.repo, peer, p_revs, force_push):
1562
+ for ref in ok_refs:
1563
+ puts(b"ok %s" % ref)
1496
1564
  return
1497
1565
 
1498
1566
  success = True
@@ -1513,12 +1581,18 @@ def do_push_hg(parser):
1513
1581
  if not peer.pushkey(b'bookmarks', bmark, old, new):
1514
1582
  success = False
1515
1583
  puts(b"error %s" % ref)
1584
+ ok_refs.remove(ref)
1516
1585
  else:
1517
1586
  # update local bookmarks
1518
1587
  for ref, bmark, old, new in p_bmarks:
1519
1588
  if not bookmarks.pushbookmark(parser.repo, bmark, old, new):
1520
1589
  success = False
1521
1590
  puts(b"error %s" % ref)
1591
+ ok_refs.remove(ref)
1592
+
1593
+ # update rest of the refs
1594
+ for ref in ok_refs:
1595
+ puts(b"ok %s" % ref)
1522
1596
 
1523
1597
  return success
1524
1598
 
@@ -1602,10 +1676,7 @@ def do_push_refspec(parser, refspec, revs):
1602
1676
  tmpfastexport = open(os.path.join(marksdir, b'git-fast-export-%d' % (os.getpid())), 'w+b')
1603
1677
  subprocess.check_call(cmd, stdin=None, stdout=tmpfastexport)
1604
1678
  try:
1605
- import imp
1606
- sys.dont_write_bytecode = True
1607
- ctx.hghelper = imp.load_source('hghelper', \
1608
- os.path.join(os.path.dirname(__file__), 'git-hg-helper'))
1679
+ ctx.hghelper = import_sibling('hghelper', 'git-hg-helper')
1609
1680
  ctx.hghelper.init_git(gitdir)
1610
1681
  ctx.gitmarks = ctx.hghelper.GitMarks(tmpmarks)
1611
1682
  # let processing know it should not bother pushing if not requested
@@ -1727,8 +1798,7 @@ def fix_path(alias, repo, orig_url):
1727
1798
  url = compat.urlparse(orig_url, b'file')
1728
1799
  if url.scheme != b'file' or os.path.isabs(os.path.expanduser(url.path)):
1729
1800
  return
1730
- abs_url = compat.urljoin(b"%s/" % compat.getcwd(), orig_url)
1731
- cmd = ['git', 'config', b'remote.%s.url' % alias, b"hg::%s" % abs_url]
1801
+ cmd = ['git', 'config', b'remote.%s.url' % alias, b"hg::%s" % os.path.abspath(orig_url)]
1732
1802
  subprocess.call(cmd)
1733
1803
 
1734
1804
  def select_private_refs(alias):
@@ -1843,6 +1913,7 @@ def main(args):
1843
1913
  global capability_push
1844
1914
  global remove_username_quotes
1845
1915
  global marksdir
1916
+ global dotfile_suffix
1846
1917
 
1847
1918
  marks = None
1848
1919
  is_tmp = False
@@ -1862,6 +1933,7 @@ def main(args):
1862
1933
  track_branches = get_config_bool('remote-hg.track-branches', True)
1863
1934
  capability_push = get_config_bool('remote-hg.capability-push', True)
1864
1935
  remove_username_quotes = get_config_bool('remote-hg.remove-username-quotes', True)
1936
+ dotfile_suffix = get_config('remote-hg.dotfile-suffix').strip() or b'_'
1865
1937
  force_push = False
1866
1938
 
1867
1939
  if hg_git_compat:
@@ -1906,7 +1978,7 @@ def main(args):
1906
1978
  fix_path(alias, peer or repo, url)
1907
1979
 
1908
1980
  marks_path = os.path.join(marksdir, b'marks-hg')
1909
- marks = Marks(marks_path, repo)
1981
+ marks = Marks(marks_path)
1910
1982
 
1911
1983
  if sys.platform == 'win32':
1912
1984
  import msvcrt
@@ -1,20 +1,12 @@
1
- Metadata-Version: 1.1
1
+ Metadata-Version: 2.4
2
2
  Name: git-remote-hg
3
- Version: 1.0.2.1
3
+ Version: 1.0.5
4
4
  Summary: access hg repositories as git remotes
5
5
  Home-page: http://github.com/mnauw/git-remote-hg
6
6
  Author: Mark Nauwelaerts
7
7
  Author-email: mnauw@users.sourceforge.net
8
8
  License: GPLv2
9
- Description:
10
- 'git-remote-hg' is a gitremote protocol helper for Mercurial.
11
- It allows you to clone, fetch and push to and from Mercurial repositories as if
12
- they were Git ones using a hg::some-url URL.
13
-
14
- See the homepage for much more explanation.
15
-
16
9
  Keywords: git hg mercurial
17
- Platform: UNKNOWN
18
10
  Classifier: Programming Language :: Python
19
11
  Classifier: Programming Language :: Python :: 2
20
12
  Classifier: Programming Language :: Python :: 2.7
@@ -24,3 +16,20 @@ Classifier: License :: OSI Approved
24
16
  Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
25
17
  Classifier: Development Status :: 5 - Production/Stable
26
18
  Classifier: Intended Audience :: Developers
19
+ License-File: LICENSE
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: home-page
25
+ Dynamic: keywords
26
+ Dynamic: license
27
+ Dynamic: license-file
28
+ Dynamic: summary
29
+
30
+
31
+ 'git-remote-hg' is a gitremote protocol helper for Mercurial.
32
+ It allows you to clone, fetch and push to and from Mercurial repositories as if
33
+ they were Git ones using a hg::some-url URL.
34
+
35
+ See the homepage for much more explanation.
@@ -1,7 +1,10 @@
1
+ LICENSE
1
2
  git-hg-helper
2
3
  git-remote-hg
4
+ setup.cfg
3
5
  setup.py
4
6
  git_remote_hg.egg-info/PKG-INFO
5
7
  git_remote_hg.egg-info/SOURCES.txt
6
8
  git_remote_hg.egg-info/dependency_links.txt
7
- git_remote_hg.egg-info/top_level.txt
9
+ git_remote_hg.egg-info/top_level.txt
10
+ p3/bin/activate_this.py
@@ -0,0 +1,34 @@
1
+ """By using execfile(this_file, dict(__file__=this_file)) you will
2
+ activate this virtualenv environment.
3
+
4
+ This can be used when you must use an existing Python interpreter, not
5
+ the virtualenv bin/python
6
+ """
7
+
8
+ try:
9
+ __file__
10
+ except NameError:
11
+ raise AssertionError(
12
+ "You must run this like execfile('path/to/activate_this.py', dict(__file__='path/to/activate_this.py'))")
13
+ import sys
14
+ import os
15
+
16
+ old_os_path = os.environ.get('PATH', '')
17
+ os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + os.pathsep + old_os_path
18
+ base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
19
+ if sys.platform == 'win32':
20
+ site_packages = os.path.join(base, 'Lib', 'site-packages')
21
+ else:
22
+ site_packages = os.path.join(base, 'lib', 'python%s' % sys.version[:3], 'site-packages')
23
+ prev_sys_path = list(sys.path)
24
+ import site
25
+ site.addsitedir(site_packages)
26
+ sys.real_prefix = sys.prefix
27
+ sys.prefix = base
28
+ # Move the added items to the front of the path:
29
+ new_sys_path = []
30
+ for item in list(sys.path):
31
+ if item not in prev_sys_path:
32
+ new_sys_path.append(item)
33
+ sys.path.remove(item)
34
+ sys.path[:0] = new_sys_path
@@ -0,0 +1,9 @@
1
+ [flake8]
2
+ ignore = E126, E127, E128, E401, E402, E741, E301, E302, E305, W503, W504
3
+ max-line-length = 140
4
+ max-complexity = 100
5
+
6
+ [egg_info]
7
+ tag_build =
8
+ tag_date = 0
9
+
@@ -1,12 +1,9 @@
1
1
  # git-remote-hg setuptools script
2
2
 
3
3
  import setuptools
4
- import subprocess
5
- import sys
6
- import os
7
4
 
8
5
  # strip leading v
9
- version = 'v1.0.2.1'[1:]
6
+ version = 'v1.0.5'[1:]
10
7
 
11
8
  # check for released version
12
9
  assert (len(version) > 0)
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-