Changed "gclient sync -D" logic to compare against the expected DEPS version

Also add a better warning if 'gclient sync -D' fails due to a modified file.
I've tested this code via deleting a DEP and running gclient sync -D.

Bug: 981149
Change-Id: I97035ac238d163ccb1684c3ee423c223ed0f6299
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891830
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Anthony Polito <apolito@google.com>
diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py
index f7490e1..6fb0b76 100755
--- a/tests/gclient_scm_test.py
+++ b/tests/gclient_scm_test.py
@@ -307,8 +307,9 @@
     file_path = join(self.base_path, 'a')
     with open(file_path, 'a') as f:
       f.writelines('touched\n')
-    scm = gclient_scm.GitWrapper(self.url, self.root_dir,
-                                 self.relpath)
+    scm = gclient_scm.GitWrapper(
+        self.url + '@069c602044c5388d2d15c3f875b057c852003458', self.root_dir,
+        self.relpath)
     file_list = []
     scm.status(options, self.args, file_list)
     self.assertEqual(file_list, [file_path])
@@ -317,6 +318,22 @@
          '069c602044c5388d2d15c3f875b057c852003458\' in \'%s\'\n\nM\ta\n') %
             join(self.root_dir, '.'))
 
+
+  def testStatusNewNoBaseRev(self):
+    if not self.enabled:
+      return
+    options = self.Options()
+    file_path = join(self.base_path, 'a')
+    with open(file_path, 'a') as f:
+      f.writelines('touched\n')
+    scm = gclient_scm.GitWrapper(self.url, self.root_dir, self.relpath)
+    file_list = []
+    scm.status(options, self.args, file_list)
+    self.assertEqual(file_list, [file_path])
+    self.checkstdout(
+        ('\n________ running \'git -c core.quotePath=false diff --name-status'
+         '\' in \'%s\'\n\nM\ta\n') % join(self.root_dir, '.'))
+
   def testStatus2New(self):
     if not self.enabled:
       return
@@ -327,8 +344,9 @@
       with open(file_path, 'a') as f:
         f.writelines('touched\n')
       expected_file_list.extend([file_path])
-    scm = gclient_scm.GitWrapper(self.url, self.root_dir,
-                                 self.relpath)
+    scm = gclient_scm.GitWrapper(
+        self.url + '@069c602044c5388d2d15c3f875b057c852003458', self.root_dir,
+        self.relpath)
     file_list = []
     scm.status(options, self.args, file_list)
     expected_file_list = [join(self.base_path, x) for x in ['a', 'b']]