summaryrefslogtreecommitdiffstats
path: root/editor.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix blank line issues reported by flake8David Pursehouse2020-02-121-0/+1
| | | | | | | | | | | | | | | | | | | | - E301 expected 1 blank line - E302 expected 2 blank lines - E303 too many blank lines - E305 expected 2 blank lines after class or function definition - E306 expected 1 blank line before a nested definition Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E301,E302,E303,E305,E306 Manually fix issues in project.py caused by misuse of block comments. Change-Id: Iee840fcaff48aae504ddac9c3e76d2acd484f6a9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254599 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Fix indentation issues reported by flake8David Pursehouse2020-02-121-3/+3
| | | | | | | | | | | | | | | | | | | | | - E121 continuation line under-indented for hanging indent - E122 continuation line missing indentation or outdented - E125 continuation line with same indent as next logical line - E126 continuation line over-indented for hanging indent - E127 continuation line over-indented for visual indent - E128 continuation line under-indented for visual indent - E129 visually indented line with same indent as next logical line - E131 continuation line unaligned for hanging indent Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E121,E122,E125,E126,E127,E128,E129,E131 Change-Id: Ifd95fb8e6a1a4d6e9de187b5787d64a6326dd249 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254605 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* upload/editor: fix bytes/string confusionMike Frysinger2019-11-161-7/+10
| | | | | | | | | | | | | | | | The upload module tries to turn the strings into bytes before passing to EditString, but it combines bytes & strings causing an error. The return value might be bytes or string, but the caller only expects a string. Lets simplify this by sticking to strings everywhere and have EditString take care of converting to/from bytes when reading/writing the underlying files. This also avoids possible locale confusion when reading the file by forcing UTF-8 everywhere. Bug: https://crbug.com/gerrit/11929 Change-Id: I07b146170c5e8b5b0500a2c79e4213cd12140a96 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/245621 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* use open context managers in more placesMike Frysinger2019-11-121-4/+1
| | | | | | | | | | Use open() as a context manager to simplify the close logic and make the code easier to read & understand. This is also more Pythonic. Change-Id: I579d03cca86f99b2c6c6a1f557f6e5704e2515a7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244734 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* set default file encoding to utf-8Mike Frysinger2019-06-131-0/+1
| | | | | | | | There's no reason to support any other encoding in these files. This only affects the files themselves and not streams they open. Bug: https://crbug.com/gerrit/10418 Change-Id: I053cb40cd3666ce5c8a0689b9dd938f24ca765bf
* Allow quotes in editor command on WindowsRenaud Paquay2017-08-311-1/+6
| | | | | | | | | | | | This change allows setting the EDITOR env. variable to point to a program location that contains quotes and spaces. For example: > set EDITOR="C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst -nosession > repo upload Change-Id: Ic95b00f7443982b1956a2992d0220e50b1cf6bbb
* Replace all os.remove callsRenaud Paquay2017-08-311-1/+2
| | | | | | | | os.remove raises an exception when deleting read-only files on Windows. Replace all calls with calls to platform_utils.remove, which deals with deals with that issue. Change-Id: I4dc9e0c9a36b4238880520c69f5075eca40f3e66
* Change print statements to work in python3Sarah Owens2012-11-131-3/+4
| | | | | | This is part of a series of changes to introduce Python3 support. Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
* Use modern Python exception syntaxSarah Owens2012-10-231-1/+1
| | | | | | | | | | | "except Exception as e" instead of "except Exception, e" This is part of a transition to supporting Python 3. Python >= 2.6 support "as" syntax. Note: this removes Python 2.5 support. Change-Id: I309599f3981bba2b46111c43102bee38ff132803
* Fix for handling values of EDITOR which contain a space.Patrick Dubroy2010-08-061-1/+1
| | | | | | | The shell swallows the 0th arg, which was the filename. Simple fix is to pass in an extra arg for the shell to swallow. Change-Id: Iad6304ba9ccea6e7262ee06ef87d3dac57dbde81
* Support GIT_EDITOR='vim -c "set textwidth=80"'Shawn O. Pearce2009-07-021-7/+20
| | | | | | | | | If there are shell special characters in the editor string, we must use /bin/sh to parse and execute it, rather than trying to rely on a simple split(' '). This avoids vim starting up with two empty buffers, due to a misparsed command line. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Document any crashes from the user's text editorv1.6.8.4Shawn O. Pearce2009-06-241-2/+9
| | | | | | | | Rather than failing with no information, display the child exit status and the command line we tried to use to edit a text file. There may be some useful information to help understand the crash. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix launching of editor under 'repo upload --replace'Shawn O. Pearce2009-04-181-3/+3
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Make usage of open safer by setting binary mode and closing fdsShawn O. Pearce2009-04-181-1/+5
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Make repo's editor work when the editor is a commandline withv1.3.2Joe Onorato2008-11-141-2/+2
| | | | multiple args.
* Initial Contributionv1.0The Android Open Source Project2008-10-211-0/+85