Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/convert/git.py @ 5233:9d7052f17d77
convert: fix /dev/null redirections under Windows
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 26 Aug 2007 19:05:19 +0200 |
parents | 149742a628fd |
children | 20770c5d41e0 88e931f74e8b |
comparison
equal
deleted
inserted
replaced
5231:ceb6f242fb81 | 5233:9d7052f17d77 |
---|---|
1 # git support for the convert extension | 1 # git support for the convert extension |
2 | 2 |
3 import os | 3 import os |
4 from mercurial import util | |
4 | 5 |
5 from common import NoRepo, commit, converter_source | 6 from common import NoRepo, commit, converter_source |
6 | 7 |
7 def recode(s): | 8 def recode(s): |
8 try: | 9 try: |
44 fh = self.gitcmd("git-rev-parse --verify HEAD") | 45 fh = self.gitcmd("git-rev-parse --verify HEAD") |
45 return [fh.read()[:-1]] | 46 return [fh.read()[:-1]] |
46 | 47 |
47 def catfile(self, rev, type): | 48 def catfile(self, rev, type): |
48 if rev == "0" * 40: raise IOError() | 49 if rev == "0" * 40: raise IOError() |
49 fh = self.gitcmd("git-cat-file %s %s 2>/dev/null" % (type, rev)) | 50 fh = self.gitcmd("git-cat-file %s %s 2>%s" % (type, rev, |
51 util.nulldev)) | |
50 return fh.read() | 52 return fh.read() |
51 | 53 |
52 def getfile(self, name, rev): | 54 def getfile(self, name, rev): |
53 return self.catfile(rev, "blob") | 55 return self.catfile(rev, "blob") |
54 | 56 |
103 c = commit(parents=parents, date=date, author=author, desc=message) | 105 c = commit(parents=parents, date=date, author=author, desc=message) |
104 return c | 106 return c |
105 | 107 |
106 def gettags(self): | 108 def gettags(self): |
107 tags = {} | 109 tags = {} |
108 fh = self.gitcmd('git-ls-remote --tags "%s" 2>/dev/null' % self.path) | 110 fh = self.gitcmd('git-ls-remote --tags "%s" 2>%s' % (self.path, |
111 util.nulldev)) | |
109 prefix = 'refs/tags/' | 112 prefix = 'refs/tags/' |
110 for line in fh: | 113 for line in fh: |
111 line = line.strip() | 114 line = line.strip() |
112 if not line.endswith("^{}"): | 115 if not line.endswith("^{}"): |
113 continue | 116 continue |