| LEFT | RIGHT |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2007 Google Inc. | 3 # Copyright 2007 Google Inc. |
| 4 # | 4 # |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); | 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 # you may not use this file except in compliance with the License. | 6 # you may not use this file except in compliance with the License. |
| 7 # You may obtain a copy of the License at | 7 # You may obtain a copy of the License at |
| 8 # | 8 # |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 | 9 # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 # | 10 # |
| (...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1286 # Mercurial has a command to get the base directory of a repository | 1286 # Mercurial has a command to get the base directory of a repository |
| 1287 # Try running it, but don't die if we don't have hg installed. | 1287 # Try running it, but don't die if we don't have hg installed. |
| 1288 # NOTE: we try Mercurial first as it can sit on top of an SVN working copy. | 1288 # NOTE: we try Mercurial first as it can sit on top of an SVN working copy. |
| 1289 try: | 1289 try: |
| 1290 out, returncode = RunShellWithReturnCode(["hg", "root"]) | 1290 out, returncode = RunShellWithReturnCode(["hg", "root"]) |
| 1291 if returncode == 0: | 1291 if returncode == 0: |
| 1292 return MercurialVCS(options, out.strip()) | 1292 return MercurialVCS(options, out.strip()) |
| 1293 except OSError, (errno, message): | 1293 except OSError, (errno, message): |
| 1294 if errno != 2: # ENOENT -- they don't have hg installed. | 1294 if errno != 2: # ENOENT -- they don't have hg installed. |
| 1295 raise | 1295 raise |
| 1296 | 1296 try: |
|
bialix
2009/03/24 22:49:23
I think you need either use command ["bzr", "--no-
| |
| 1297 out, returncode = RunShellWithReturnCode(["bzr", "root"]) | |
| 1298 if returncode == 0: | |
| 1299 os.chdir(out.strip()) | |
| 1300 return BazaarVCS(options) | |
| 1301 except OSError, (errno, message): | |
| 1302 if errno != 2: # ENOENT -- they don't have bzr installed. | |
| 1303 raise | |
| 1297 # Subversion has a .svn in all working directories. | 1304 # Subversion has a .svn in all working directories. |
| 1298 if os.path.isdir('.svn'): | 1305 if os.path.isdir('.svn'): |
| 1299 logging.info("Guessed VCS = Subversion") | 1306 logging.info("Guessed VCS = Subversion") |
| 1300 return SubversionVCS(options) | 1307 return SubversionVCS(options) |
| 1301 elif os.path.isdir(".bzr"): | 1308 |
| 1302 logging.info("Guessed VCS = Bazaar") | |
| 1303 return BazaarVCS(options) | |
| 1304 # Git has a command to test if you're in a git tree. | 1309 # Git has a command to test if you're in a git tree. |
| 1305 # Try running it, but don't die if we don't have git installed. | 1310 # Try running it, but don't die if we don't have git installed. |
| 1306 try: | 1311 try: |
| 1307 out, returncode = RunShellWithReturnCode(["git", "rev-parse", | 1312 out, returncode = RunShellWithReturnCode(["git", "rev-parse", |
| 1308 "--is-inside-work-tree"]) | 1313 "--is-inside-work-tree"]) |
| 1309 if returncode == 0: | 1314 if returncode == 0: |
| 1310 return GitVCS(options) | 1315 return GitVCS(options) |
| 1311 except OSError, (errno, message): | 1316 except OSError, (errno, message): |
| 1312 if errno != 2: # ENOENT -- they don't have git installed. | 1317 if errno != 2: # ENOENT -- they don't have git installed. |
| 1313 raise | 1318 raise |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1434 try: | 1439 try: |
| 1435 RealMain(sys.argv) | 1440 RealMain(sys.argv) |
| 1436 except KeyboardInterrupt: | 1441 except KeyboardInterrupt: |
| 1437 print | 1442 print |
| 1438 StatusUpdate("Interrupted.") | 1443 StatusUpdate("Interrupted.") |
| 1439 sys.exit(1) | 1444 sys.exit(1) |
| 1440 | 1445 |
| 1441 | 1446 |
| 1442 if __name__ == "__main__": | 1447 if __name__ == "__main__": |
| 1443 main() | 1448 main() |
| LEFT | RIGHT |