After much refactory, finally add significant functionalities to trychanges.py

Add real logging support.
Fix the patch path mungling that was broken earlier.
Add and proper refactor automatic gclient and gcl settings detection.
Factored so it is possible to add other autodetection algorithms.
Now works standalone in hybrid svn&git checkouts within a gclient meta-checkout.

TEST=bah
BUG=none
TBR=bradnelson

Review URL: http://codereview.chromium.org/517005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@35218 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_utils.py b/gclient_utils.py
index af98457..b83f8c9 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -15,6 +15,7 @@
 """Generic utils."""
 
 import errno
+import logging
 import os
 import re
 import stat
@@ -40,6 +41,7 @@
 
   Works on python 2.4
   """
+  logging.debug(command)
   try:
     stderr = None
     if not print_error:
@@ -162,6 +164,7 @@
   In the ordinary case, this is not a problem: for our purposes, the user
   will never lack write permission on *path's parent.
   """
+  logging.debug(path)
   file_path = os.path.join(*path)
   if not os.path.exists(file_path):
     return
@@ -256,7 +259,7 @@
   exit with an exit status of fail_status.  If fail_status is None (the
   default), gclient will raise an Error exception.
   """
-
+  logging.debug(command)
   if print_messages:
     print("\n________ running \'%s\' in \'%s\'"
           % (' '.join(command), in_directory))
@@ -316,6 +319,7 @@
     if not next[1]:
       return None
     path = next[0]
+  logging.info('Found gclient root at ' + path)
   return path
 
 def PathDifference(root, subpath):