changeset 260:6977263c4d80

Merge with abderrahim.
author Augie Fackler <durin42@gmail.com>
date Sun, 25 Oct 2009 10:55:12 -0500
parents 8b9fc1b1cc40 (diff) 1590c97d7af0 (current diff)
children 29e5072ddaab
files hggit/__init__.py hggit/git_handler.py hggit/gitrepo.py
diffstat 27 files changed, 126 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/.gitignore
+++ b/.gitignore
@@ -1,1 +1,5 @@
 *.pyc
+tests/*.err
+build
+dist
+*.egg-info
--- a/.hgignore
+++ b/.hgignore
@@ -1,4 +1,6 @@
 syntax: glob
-
 *.pyc
 tests/*.err
+build
+dist
+*.egg-info
new file mode 100644
--- /dev/null
+++ b/.hgtags
@@ -0,0 +1,1 @@
+505d7cdca19838bfb270193e0709154a2dad5c19 0.1.0
--- a/README.md
+++ b/README.md
@@ -20,24 +20,24 @@
 
 You can clone a Git repository from Hg by running `hg clone [url]`.  For example, if you were to run `hg clone git://github.com/schacon/munger.git` it would clone the repository down into the directory 'munger.git', then convert it to an Hg repository for you.
 
-	hg clone git://github.com/schacon/hg-git.git
+        hg clone git://github.com/schacon/hg-git.git
 
 If you want to clone a github repository for later pushing (or any other repository you access via ssh), you need to convert the ssh url to a format with explicit protocol prefix (mind the switch from colon to slash after the host!):
 
-	git clone git@github.com:schacon/hg-git.git
-	hg clone git+ssh://git@github.com/schacon/hg-git.git
+        git clone git@github.com:schacon/hg-git.git
+        hg clone git+ssh://git@github.com/schacon/hg-git.git
 
 If you are starting from an existing Hg repository, you have to setup a Git repository somewhere that you have push access to, add it as default path or default-push path in your .hg/hgrc and then run `hg push` from within your project.  For example:
 
-	cd hg-git # (an Hg repository)
-	(edit .hg/hgrc and add the target git url in the paths section)
-	hg push
+        cd hg-git # (an Hg repository)
+        (edit .hg/hgrc and add the target git url in the paths section)
+        hg push
 
 This will convert all your Hg data into Git objects and push them up to the Git server.
 
 Now that you have an Hg repository that can push/pull to/from a Git repository, you can fetch updates with `hg pull`.
 
-	$ hg pull
+        $ hg pull
 
 That will pull down any commits that have been pushed to the server in the meantime and give you a new head that you can merge in.
 
@@ -53,9 +53,9 @@
 
 Clone this repository somewhere and make the 'extensions' section in your `~/.hgrc` file look something like this:
 
-	[extensions]
-	hgext.bookmarks =
-	hgext.hg-git = [path-to]/hg-git
+        [extensions]
+        hgext.bookmarks =
+        hggit = [path-to]/hg-git/hggit
 
 That will enable the Hg-Git extension for you.  The bookmarks section is not compulsory, but it makes some things a bit nicer for you.
 
@@ -63,10 +63,13 @@
 ========
 
 * Scott Chacon <schacon@gmail.com> - main development
-* Augie Fackler <durin42@gmail.com> - testing and moral support
+* Augie Fackler <durin42@gmail.com> - testing and moral support, janitor
 * Sverre Rabbelier <sverre@rabbelier.nl> - gexport, mode and i18n stuff and misc fixes
+* Abderrahim Kitouni <a.kitouni@gmail.com> - more "mercurialistic" UI
+* Kevin Bullock <kbullock@ringworld.org> - proper packaging for PyPI
+
 * Dulwich Developers - most of this code depends on the awesome work they did.
- 
+
 Sponsorship
 ===========
 
rename from __init__.py
rename to hggit/__init__.py
--- a/__init__.py
+++ b/hggit/__init__.py
@@ -1,7 +1,7 @@
 # git.py - git server bridge
 #
 # Copyright 2008 Scott Chacon <schacon at gmail dot com>
-#   also some code (and help) borrowed from durin42  
+#   also some code (and help) borrowed from durin42
 #
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
@@ -9,9 +9,10 @@
 '''push and pull from a Git server
 
 This extension lets you communicate (push and pull) with a Git server.
-This way you can use Git hosting for your project or collaborate with a 
+This way you can use Git hosting for your project or collaborate with a
 project that is in Git.  A bridger of worlds, this plugin be.
 
+Try hg clone git:// or hg clone git+ssh://
 '''
 
 import os
rename from git_handler.py
rename to hggit/git_handler.py
rename from gitrepo.py
rename to hggit/gitrepo.py
rename from hgrepo.py
rename to hggit/hgrepo.py
rename from toposort.py
rename to hggit/toposort.py
new file mode 100644
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,23 @@
+try:
+    from setuptools import setup
+except:
+    from distutils.core import setup
+
+setup(
+    name='hg-git',
+    version='0.1.0',
+    author='Scott Chacon',
+    maintainer='Augie Fackler',
+    maintainer_email='durin42@gmail.com',
+    url='http://hg-git.github.com/',
+    description='push and pull from a Git server using Mercurial',
+    long_description="""
+This extension lets you communicate (push and pull) with a Git server.
+This way you can use Git hosting for your project or collaborate with a
+project that is in Git.  A bridger of worlds, this plugin be.
+    """.strip(),
+    keywords='hg git mercurial',
+    license='GPLv2',
+    packages=['hggit'],
+    install_requires=['dulwich>=0.4.0'],
+)
--- a/tests/test-empty-working-tree
+++ b/tests/test-empty-working-tree
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2> /dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
@@ -21,7 +24,7 @@
 cd gitrepo
 git init | python -c "import sys; print sys.stdin.read().replace('$(dirname $(pwd))/', '')"
 
-git commit --allow-empty -m empty >/dev/null 2>/dev/null || echo "hg commit error"
+git commit --allow-empty -m empty | sed -E 's/.*([0-9a-f]{7})[]:]/Commit \1/'
 
 cd ..
 mkdir gitrepo2
--- a/tests/test-empty-working-tree.out
+++ b/tests/test-empty-working-tree.out
@@ -1,5 +1,6 @@
 Initialized empty Git repository in gitrepo/.git/
 
+Commit 6782568 empty
 Initialized empty Git repository in gitrepo2/.git/
 
 importing Hg objects into Git
--- a/tests/test-encoding
+++ b/tests/test-encoding
@@ -5,11 +5,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-file-removal
+++ b/tests/test-file-removal
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-git-clone
+++ b/tests/test-git-clone
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-git-tags
+++ b/tests/test-git-tags
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-hg-author
+++ b/tests/test-hg-author
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-hg-branch
+++ b/tests/test-hg-branch
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-hg-tags
+++ b/tests/test-hg-tags
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-merge
+++ b/tests/test-merge
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
@@ -45,7 +48,7 @@
 commit -m 'add gamma'
 
 # clean merge
-git merge beta
+git merge beta | sed 's/\.{3}//'
 
 cd ..
 mkdir gitrepo2
--- a/tests/test-octopus
+++ b/tests/test-octopus
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
@@ -50,7 +53,7 @@
 git add delta
 commit -m 'add delta'
 
-git merge branch1 branch2
+git merge branch1 branch2 | sed 's/\.{3}//'
 
 cd ..
 mkdir gitrepo2
--- a/tests/test-outgoing
+++ b/tests/test-outgoing
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-pull
+++ b/tests/test-pull
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-push
+++ b/tests/test-push
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
--- a/tests/test-sane-without-bookmarks
+++ b/tests/test-sane-without-bookmarks
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2>/dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.graphlog =' >> $HGRCPATH
 
 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
--- a/tests/test-tree-decomposition
+++ b/tests/test-tree-decomposition
@@ -3,11 +3,14 @@
 # Fails for some reason, need to investigate
 # "$TESTDIR/hghave" git || exit 80
 
+# bail if the user does not have dulwich
+python -c 'import dulwich, dulwich.repo' || exit 80
+
 # bail early if the user is already running git-daemon
 echo hi | nc localhost 9418 2> /dev/null && exit 80
 
 echo "[extensions]" >> $HGRCPATH
-echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH
 echo 'hgext.bookmarks =' >> $HGRCPATH
 
 GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
@@ -33,11 +36,11 @@
 mkdir d1
 touch d1/f1 d1/f2
 git add d1/f1 d1/f2
-commit -m initial
+git commit -m initial | sed -E 's/.*([0-9a-f]{7})[]:]/Commit \1/'
 
 mkdir d2
 git mv d1/f2 d2/f2
-commit -m 'rename'
+git commit -m 'rename' | sed -E 's/.*([0-9a-f]{7})[]:]/Commit \1/'
 
 cd ..
 mkdir gitrepo2
--- a/tests/test-tree-decomposition.out
+++ b/tests/test-tree-decomposition.out
@@ -1,5 +1,12 @@
 Initialized empty Git repository in gitrepo/.git/
 
+Commit 60fd61f initial
+ 0 files changed, 0 insertions(+), 0 deletions(-)
+ create mode 100644 d1/f1
+ create mode 100644 d1/f2
+Commit a2e8665 rename
+ 1 files changed, 0 insertions(+), 0 deletions(-)
+ rename {d1 => d2}/f2 (100%)
 Initialized empty Git repository in gitrepo2/.git/
 
 importing Hg objects into Git
@@ -17,14 +24,14 @@
 importing Hg objects into Git
 at: 0/2
 creating and sending data
-commit 7d84da95f2caf7a65833ae580fe5a08a0c3cb6b2
+commit a2e8665d117167742ceb040f1669a73289d79ac8
 Author: test <test@example.org>
-Date:   Mon Jan 1 00:00:11 2007 +0000
+Date:   Mon Jan 1 00:00:00 2007 +0000
 
     rename
 
-commit 48e6424b6487f2a16e901f72fe52168b40278f5b
+commit 60fd61fbaca983e6d0ee911668ef7547abbf720c
 Author: test <test@example.org>
-Date:   Mon Jan 1 00:00:10 2007 +0000
+Date:   Mon Jan 1 00:00:00 2007 +0000
 
     initial