* [PATCH 1/5] hg-to-git: avoid raising a string exception
2008-07-06 3:15 [PATCH 0/5] hg-to-git fixes Miklos Vajna
@ 2008-07-06 3:15 ` Miklos Vajna
2008-07-06 3:15 ` [PATCH 2/5] hg-to-git: abort if the project directory is not a hg repo Miklos Vajna
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Miklos Vajna @ 2008-07-06 3:15 UTC (permalink / raw)
To: Stelian Pop; +Cc: Junio C Hamano, git
This fixes the following warning:
hg-to-git.py:92: DeprecationWarning: raising a string exception is deprecated
Signed-off-by: Miklos Vajna <vmiklos@frugalware•org>
---
contrib/hg-to-git/hg-to-git.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index f68ef72..25d9941 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -89,7 +89,7 @@ try:
if o in ('-v', '--verbose'):
verbose = True
if len(args) != 1:
- raise('params')
+ raise Exception('params')
except:
usage()
sys.exit(1)
--
1.5.6.1.322.ge904b.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/5] hg-to-git: abort if the project directory is not a hg repo
2008-07-06 3:15 [PATCH 0/5] hg-to-git fixes Miklos Vajna
2008-07-06 3:15 ` [PATCH 1/5] hg-to-git: avoid raising a string exception Miklos Vajna
@ 2008-07-06 3:15 ` Miklos Vajna
2008-07-06 3:15 ` [PATCH 3/5] hg-to-git: rewrite "git-frotz" to "git frotz" Miklos Vajna
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Miklos Vajna @ 2008-07-06 3:15 UTC (permalink / raw)
To: Stelian Pop; +Cc: Junio C Hamano, git
Check the exit code of the first hg command, and abort to avoid a later
ValueError exception.
Signed-off-by: Miklos Vajna <vmiklos@frugalware•org>
---
contrib/hg-to-git/hg-to-git.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index 25d9941..130b1c4 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -106,7 +106,10 @@ if state:
else:
print 'State does not exist, first run'
-tip = os.popen('hg tip --template "{rev}"').read()
+sock = os.popen('hg tip --template "{rev}"')
+tip = sock.read()
+if sock.close():
+ sys.exit(1)
if verbose:
print 'tip is', tip
--
1.5.6.1.322.ge904b.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/5] hg-to-git: rewrite "git-frotz" to "git frotz"
2008-07-06 3:15 [PATCH 0/5] hg-to-git fixes Miklos Vajna
2008-07-06 3:15 ` [PATCH 1/5] hg-to-git: avoid raising a string exception Miklos Vajna
2008-07-06 3:15 ` [PATCH 2/5] hg-to-git: abort if the project directory is not a hg repo Miklos Vajna
@ 2008-07-06 3:15 ` Miklos Vajna
2008-07-06 3:15 ` [PATCH 4/5] hg-to-git: use git init instead of git init-db Miklos Vajna
2008-07-06 3:15 ` [PATCH 5/5] hg-to-git: use git rev-parse instead of git show Miklos Vajna
4 siblings, 0 replies; 6+ messages in thread
From: Miklos Vajna @ 2008-07-06 3:15 UTC (permalink / raw)
To: Stelian Pop; +Cc: Junio C Hamano, git
This is not just nice but necessary since git-frotz is no longer in
PATH.
Signed-off-by: Miklos Vajna <vmiklos@frugalware•org>
---
contrib/hg-to-git/hg-to-git.py | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index 130b1c4..61540ef 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -152,7 +152,7 @@ for cset in range(1, int(tip) + 1):
if not hgvers.has_key("0"):
print 'creating repository'
- os.system('git-init-db')
+ os.system('git init-db')
# loop through every hg changeset
for cset in range(int(tip) + 1):
@@ -194,10 +194,10 @@ for cset in range(int(tip) + 1):
if cset != 0:
if hgbranch[str(cset)] == "branch-" + str(cset):
print 'creating new branch', hgbranch[str(cset)]
- os.system('git-checkout -b %s %s' % (hgbranch[str(cset)], hgvers[parent]))
+ os.system('git checkout -b %s %s' % (hgbranch[str(cset)], hgvers[parent]))
else:
print 'checking out branch', hgbranch[str(cset)]
- os.system('git-checkout %s' % hgbranch[str(cset)])
+ os.system('git checkout %s' % hgbranch[str(cset)])
# merge
if mparent:
@@ -206,7 +206,7 @@ for cset in range(int(tip) + 1):
else:
otherbranch = hgbranch[parent]
print 'merging', otherbranch, 'into', hgbranch[str(cset)]
- os.system(getgitenv(user, date) + 'git-merge --no-commit -s ours "" %s %s' % (hgbranch[str(cset)], otherbranch))
+ os.system(getgitenv(user, date) + 'git merge --no-commit -s ours "" %s %s' % (hgbranch[str(cset)], otherbranch))
# remove everything except .git and .hg directories
os.system('find . \( -path "./.hg" -o -path "./.git" \) -prune -o ! -name "." -print | xargs rm -rf')
@@ -215,9 +215,9 @@ for cset in range(int(tip) + 1):
os.system('hg update -C %d' % cset)
# add new files
- os.system('git-ls-files -x .hg --others | git-update-index --add --stdin')
+ os.system('git ls-files -x .hg --others | git update-index --add --stdin')
# delete removed files
- os.system('git-ls-files -x .hg --deleted | git-update-index --remove --stdin')
+ os.system('git ls-files -x .hg --deleted | git update-index --remove --stdin')
# commit
os.system(getgitenv(user, date) + 'git commit --allow-empty -a -F %s' % filecomment)
@@ -225,20 +225,20 @@ for cset in range(int(tip) + 1):
# tag
if tag and tag != 'tip':
- os.system(getgitenv(user, date) + 'git-tag %s' % tag)
+ os.system(getgitenv(user, date) + 'git tag %s' % tag)
# delete branch if not used anymore...
if mparent and len(hgchildren[str(cset)]):
print "Deleting unused branch:", otherbranch
- os.system('git-branch -d %s' % otherbranch)
+ os.system('git branch -d %s' % otherbranch)
# retrieve and record the version
- vvv = os.popen('git-show --quiet --pretty=format:%H').read()
+ vvv = os.popen('git show --quiet --pretty=format:%H').read()
print 'record', cset, '->', vvv
hgvers[str(cset)] = vvv
if hgnewcsets >= opt_nrepack and opt_nrepack != -1:
- os.system('git-repack -a -d')
+ os.system('git repack -a -d')
# write the state for incrementals
if state:
--
1.5.6.1.322.ge904b.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 4/5] hg-to-git: use git init instead of git init-db
2008-07-06 3:15 [PATCH 0/5] hg-to-git fixes Miklos Vajna
` (2 preceding siblings ...)
2008-07-06 3:15 ` [PATCH 3/5] hg-to-git: rewrite "git-frotz" to "git frotz" Miklos Vajna
@ 2008-07-06 3:15 ` Miklos Vajna
2008-07-06 3:15 ` [PATCH 5/5] hg-to-git: use git rev-parse instead of git show Miklos Vajna
4 siblings, 0 replies; 6+ messages in thread
From: Miklos Vajna @ 2008-07-06 3:15 UTC (permalink / raw)
To: Stelian Pop; +Cc: Junio C Hamano, git
Signed-off-by: Miklos Vajna <vmiklos@frugalware•org>
---
contrib/hg-to-git/hg-to-git.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index 61540ef..7b03204 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -152,7 +152,7 @@ for cset in range(1, int(tip) + 1):
if not hgvers.has_key("0"):
print 'creating repository'
- os.system('git init-db')
+ os.system('git init')
# loop through every hg changeset
for cset in range(int(tip) + 1):
--
1.5.6.1.322.ge904b.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 5/5] hg-to-git: use git rev-parse instead of git show
2008-07-06 3:15 [PATCH 0/5] hg-to-git fixes Miklos Vajna
` (3 preceding siblings ...)
2008-07-06 3:15 ` [PATCH 4/5] hg-to-git: use git init instead of git init-db Miklos Vajna
@ 2008-07-06 3:15 ` Miklos Vajna
4 siblings, 0 replies; 6+ messages in thread
From: Miklos Vajna @ 2008-07-06 3:15 UTC (permalink / raw)
To: Stelian Pop; +Cc: Junio C Hamano, git
'show' is a high-level command, scripts are better if they use
'rev-parse'.
Signed-off-by: Miklos Vajna <vmiklos@frugalware•org>
---
contrib/hg-to-git/hg-to-git.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/hg-to-git/hg-to-git.py b/contrib/hg-to-git/hg-to-git.py
index 7b03204..0ecb38b 100755
--- a/contrib/hg-to-git/hg-to-git.py
+++ b/contrib/hg-to-git/hg-to-git.py
@@ -233,7 +233,7 @@ for cset in range(int(tip) + 1):
os.system('git branch -d %s' % otherbranch)
# retrieve and record the version
- vvv = os.popen('git show --quiet --pretty=format:%H').read()
+ vvv = os.popen('git rev-parse HEAD').read()
print 'record', cset, '->', vvv
hgvers[str(cset)] = vvv
--
1.5.6.1.322.ge904b.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread