mirror of
https://github.com/mnauw/git-remote-hg.git
synced 2025-10-29 15:46:07 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de95133416 | ||
|
|
e0b752be8f | ||
|
|
f050de1bcc | ||
|
|
0bf3db826b | ||
|
|
3698638e98 | ||
|
|
765f9ae287 | ||
|
|
5ddcdd33ec | ||
|
|
435373ee83 |
14
Makefile
14
Makefile
@@ -26,4 +26,16 @@ install-doc: doc
|
||||
install -d -m 755 $(D)$(mandir)/
|
||||
install -m 644 doc/git-remote-hg.1 $(D)$(mandir)/git-remote-hg.1
|
||||
|
||||
.PHONY: all test install install-doc clean
|
||||
pypi:
|
||||
version=`git describe --tags ${REV}` && \
|
||||
sed -i "s/version = .*/version = '$$version'/" setup.py
|
||||
-rm -rf dist build
|
||||
python setup.py sdist bdist_wheel
|
||||
|
||||
pypi-upload:
|
||||
twine upload dist/*
|
||||
|
||||
pypi-test:
|
||||
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
||||
|
||||
.PHONY: all test install install-doc clean pypy pypy-upload
|
||||
|
||||
@@ -13,6 +13,13 @@ wget https://raw.github.com/mnauw/git-remote-hg/master/git-remote-hg -O ~/bin/gi
|
||||
chmod +x ~/bin/git-remote-hg
|
||||
--------------------------------------
|
||||
|
||||
In Windows, you also need to put and an NTFS symbolic link named `python2.exe` somewhere
|
||||
on your `$PATH` pointing to your Python 2 executable:
|
||||
|
||||
--------------------------------------
|
||||
mklink <path to link> <path to python.exe>
|
||||
--------------------------------------
|
||||
|
||||
That's it :)
|
||||
|
||||
Obviously you will need Mercurial installed.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# "$GIT_DIR/hg/origin/clone/.hg/".
|
||||
|
||||
from mercurial import hg, ui, bookmarks, context, encoding
|
||||
from mercurial import node, error, extensions, discovery, util
|
||||
from mercurial import node, error, extensions, discovery, util, scmutil
|
||||
from mercurial import changegroup
|
||||
|
||||
import re
|
||||
@@ -285,10 +285,16 @@ class Parser:
|
||||
return (user, int(date), -tz)
|
||||
|
||||
def fix_file_path(path):
|
||||
def posix_path(path):
|
||||
if os.sep == '/':
|
||||
return path
|
||||
# even Git for Windows expects forward
|
||||
return path.replace(os.sep, '/')
|
||||
# also converts forward slash to backwards slash on Win
|
||||
path = os.path.normpath(path)
|
||||
if not os.path.isabs(path):
|
||||
return path
|
||||
return os.path.relpath(path, '/')
|
||||
return posix_path(path)
|
||||
return posix_path(os.path.relpath(path, '/'))
|
||||
|
||||
def export_files(files):
|
||||
final = []
|
||||
@@ -629,7 +635,7 @@ def export_ref(repo, name, kind, head):
|
||||
notes.update(pending_revs)
|
||||
|
||||
def export_tag(repo, tag):
|
||||
export_ref(repo, tag, 'tags', repo[hgref(tag)])
|
||||
export_ref(repo, tag, 'tags', scmutil.revsingle(repo, hgref(tag)))
|
||||
|
||||
def export_bookmark(repo, bmark):
|
||||
head = bmarks[hgref(bmark)]
|
||||
@@ -1121,7 +1127,10 @@ def checkheads_bmark(repo, ref, ctx, force):
|
||||
print "error %s unknown" % ref
|
||||
return False
|
||||
|
||||
if not repo.changelog.descendant(ctx_old.rev(), ctx_new.rev()):
|
||||
# replaced around Mercurial 4.7
|
||||
isancestor = repo.changelog.isancestorrev if hasattr(repo.changelog, 'isancestorrev') \
|
||||
else repo.changelog.descendant
|
||||
if not isancestor(ctx_old.rev(), ctx_new.rev()):
|
||||
if force:
|
||||
print "ok %s forced update" % ref
|
||||
else:
|
||||
@@ -1480,6 +1489,11 @@ def do_push_refspec(parser, refspec, revs):
|
||||
if tmpmarks and os.path.exists(tmpmarks):
|
||||
if ok and not dry_run:
|
||||
# the commits made it through, now we can commit
|
||||
# sigh ... no atomic rename for existing destination on some platform ...
|
||||
# (use unofficial platform check)
|
||||
if os.sep != '/':
|
||||
if os.path.exists(marks):
|
||||
os.remove(marks)
|
||||
os.rename(tmpmarks, marks)
|
||||
revs[:] = nparser.context.revs
|
||||
else:
|
||||
|
||||
46
setup.py
Normal file
46
setup.py
Normal file
@@ -0,0 +1,46 @@
|
||||
# git-remote-hg setuptools script
|
||||
|
||||
import setuptools
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
|
||||
# strip leading v
|
||||
version = 'v1.0.1'
|
||||
|
||||
# check for released version
|
||||
assert (len(version) > 0)
|
||||
assert (version.find('-') < 0)
|
||||
|
||||
long_description = \
|
||||
"""
|
||||
'git-remote-hg' is a gitremote protocol helper for Mercurial.
|
||||
It allows you to clone, fetch and push to and from Mercurial repositories as if
|
||||
they were Git ones using a hg::some-url URL.
|
||||
|
||||
See the homepage for much more explanation.
|
||||
"""
|
||||
|
||||
CLASSIFIERS = [
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"License :: OSI Approved",
|
||||
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
]
|
||||
|
||||
setuptools.setup(name="git-remote-hg",
|
||||
version=version,
|
||||
author="Mark Nauwelaerts",
|
||||
author_email="mnauw@users.sourceforge.net",
|
||||
url="http://github.com/mnauw/git-remote-hg",
|
||||
description="access hg repositories as git remotes",
|
||||
long_description=long_description,
|
||||
license="GPLv2",
|
||||
keywords="git hg mercurial",
|
||||
scripts=["git-remote-hg", "git-hg-helper"],
|
||||
classifiers=CLASSIFIERS
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user