* [PATCH v2] git-p4: improve path encoding verbose output
@ 2015-09-16 12:37 larsxschneider
2015-09-16 12:37 ` larsxschneider
0 siblings, 1 reply; 2+ messages in thread
From: larsxschneider @ 2015-09-16 12:37 UTC (permalink / raw)
To: git; +Cc: gitster, luke, Lars Schneider
From: Lars Schneider <larsxschneider@gmail.com>
Follow up patch for a9e38359 (git-p4: add config git-p4.pathEncoding,
2015-09-03) which is already on 'next'.
diff to v1 (wrongly called v7 in "[PATCH v7] git-p4: add config git-p4.pathEncoding")
* make path encoding for utf-8 default case more explicit (thanks Junio!)
* improve commit message (thanks Luke!)
Cheers,
Lars
Lars Schneider (1):
git-p4: improve path encoding verbose output
git-p4.py | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
--
2.5.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2] git-p4: improve path encoding verbose output
2015-09-16 12:37 [PATCH v2] git-p4: improve path encoding verbose output larsxschneider
@ 2015-09-16 12:37 ` larsxschneider
0 siblings, 0 replies; 2+ messages in thread
From: larsxschneider @ 2015-09-16 12:37 UTC (permalink / raw)
To: git; +Cc: gitster, luke, Lars Schneider
From: Lars Schneider <larsxschneider@gmail.com>
If a path with non-ASCII characters is detected then print the
encoding and the encoded string in verbose mode.
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
---
git-p4.py | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/git-p4.py b/git-p4.py
index d45cf2b..e7510a9 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2220,16 +2220,15 @@ class P4Sync(Command, P4UserMap):
text = regexp.sub(r'$\1$', text)
contents = [ text ]
- if gitConfig("git-p4.pathEncoding"):
- relPath = relPath.decode(gitConfig("git-p4.pathEncoding")).encode('utf8', 'replace')
- elif self.verbose:
- try:
- relPath.decode('ascii')
- except:
- print (
- "Path with Non-ASCII characters detected and no path encoding defined. "
- "Please check the encoding: %s" % relPath
- )
+ try:
+ relPath.decode('ascii')
+ except:
+ encoding = 'utf8'
+ if gitConfig('git-p4.pathEncoding'):
+ encoding = gitConfig('git-p4.pathEncoding')
+ relPath = relPath.decode(encoding).encode('utf8', 'replace')
+ if self.verbose:
+ print 'Path with non-ASCII characters detected. Used %s to encode: %s ' % (encoding, relPath)
self.gitStream.write("M %s inline %s\n" % (git_mode, relPath))
--
2.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-16 12:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 12:37 [PATCH v2] git-p4: improve path encoding verbose output larsxschneider
2015-09-16 12:37 ` larsxschneider
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).