Repository: iterative/dvc

Issue:
Repro does not work without .git directory
In a dvc repository:
```
$ rm -rf .git
$ dvc repro featurize.dvc
Error: Unexpected error: 'Base' object has no attribute 'dir'
Having any troubles? Hit us up at dvc.org/support, we are always happy to help!
```


Discussion:
@dmpetrov , I can't reproduce your bug report, are you using the latest `dvc` version (currently `0.20.0`)?

Here are the steps I tried:
```bash
# Create directory
rm -rf example
mkdir example
cd example

# Init git and dvc
git init
dvc init

# Generate a DVC file
dvc run -o hello 'echo "hello" > hello'

# Remove git directory
rm -rf .git

# Reproduce the output `hello` output
dvc repro hello.dvc
```
```
$ git clone https://github.com/iterative/so-feature-eng-test
$ cd so-feature-eng-test/
$ dvc repro featurize.dvc # <-- fails and it is okay
Checking for updates...
Warning: You are using dvc version 0.19.15, however version 0.20.0 is available. Consider upgrading.
Output 'data/Posts.xml.tgz' of 'data/Posts.xml.tgz.dvc' changed.
Stage 'data/Posts.xml.tgz.dvc' changed.
Reproducing 'data/Posts.xml.tgz.dvc'
Verifying data sources in 'data/Posts.xml.tgz.dvc'
Error: Failed to reproduce 'featurize.dvc': Failed to reproduce 'data/Posts.xml.tgz.dvc': missing data source: data/Posts.xml.tgz

Having any troubles? Hit us up at dvc.org/support, we are always happy to help!

$ rm -rf .git/
$ dvc repro featurize.dvc # fails in a different way
Error: Unexpected error: 'Base' object has no attribute 'dir'

Having any troubles? Hit us up at dvc.org/support, we are always happy to help!
```

My concerns is the second failure.

More details:
```
$ dvc repro featurize.dvc -v
Debug: updater is not old enough to check for updates
Debug: PRAGMA user_version;
Debug: fetched: [(2,)]
Debug: CREATE TABLE IF NOT EXISTS state (inode INTEGER PRIMARY KEY, mtime TEXT NOT NULL, md5 TEXT NOT NULL, timestamp TEXT NOT NULL)
Debug: CREATE TABLE IF NOT EXISTS state_info (count INTEGER)
Debug: CREATE TABLE IF NOT EXISTS link_state (path TEXT PRIMARY KEY, inode INTEGER NOT NULL, mtime TEXT NOT NULL)
Debug: INSERT OR IGNORE INTO state_info (count) SELECT 0 WHERE NOT EXISTS (SELECT * FROM state_info)
Debug: PRAGMA user_version = 2;
Debug: SELECT count from state_info WHERE rowid=1
Debug: fetched: [(0,)]
Debug: UPDATE state_info SET count = 0 WHERE rowid = 1
Error: Traceback (most recent call last):
  File "/Users/dmitry/src/dvc/dvc/main.py", line 22, in main
    ret = cmd.run_cmd()
  File "/Users/dmitry/src/dvc/dvc/command/base.py", line 40, in run_cmd
    return self.run()
  File "/Users/dmitry/src/dvc/dvc/command/repro.py", line 25, in run
    all_pipelines=self.args.all_pipelines)
  File "/Users/dmitry/src/dvc/dvc/project.py", line 391, in reproduce
    interactive=interactive)
  File "/Users/dmitry/src/dvc/dvc/project.py", line 407, in _reproduce
    G = self.graph()[1]
  File "/Users/dmitry/src/dvc/dvc/project.py", line 882, in graph
    stages = self.stages()
  File "/Users/dmitry/src/dvc/dvc/project.py", line 965, in stages
    dirs[:] = list(filter(filter_dirs, dirs))
  File "/Users/dmitry/src/dvc/dvc/project.py", line 958, in filter_dirs
    if path == self.dvc_dir or path == self.scm.dir:
AttributeError: 'Base' object has no attribute 'dir'

Error: Unexpected error: 'Base' object has no attribute 'dir'

Having any troubles? Hit us up at dvc.org/support, we are always happy to help!
```
Updated dvc (from sources):
```
$ dvc -V
0.20.0+c4295f
```

The result is the same.
Thanks, @dmpetrov , I'll check it

Resolving patch:
diff --git a/dvc/scm.py b/dvc/scm.py
--- a/dvc/scm.py
+++ b/dvc/scm.py
@@ -18,6 +18,10 @@ def __init__(self, root_dir=os.curdir, project=None):
         self.project = project
         self.root_dir = root_dir
 
+    @property
+    def dir(self):
+        return None
+
     @staticmethod
     def is_repo(root_dir):
         return True


Test patch:
diff --git a/tests/test_repro.py b/tests/test_repro.py
--- a/tests/test_repro.py
+++ b/tests/test_repro.py
@@ -763,3 +763,9 @@ def test(self):
 
         with open(fname, 'r') as fd:
             self.assertEqual(os.getenv('SHELL'), fd.read().strip())
+
+class TestReproNoSCM(TestRepro):
+    def test(self):
+        shutil.rmtree(self.dvc.scm.dir)
+        ret = main(['repro', self.file1_stage])
+        self.assertEqual(ret, 0)