Commit graph

432 commits

Author SHA1 Message Date
Paul Gauthier
dc19a1fe4b /add treats args as literal filenames initially, only glob if they do not exist #195 2023-09-29 13:44:49 -07:00
Paul Gauthier
399d86d437 block /add of files from outside coder.root #178 2023-09-29 13:27:43 -07:00
Paul Gauthier
98bacd0b5b test case and fix for /add blowing up in subdir #201 2023-09-29 10:49:27 -07:00
Paul Gauthier
6d5827643f don't try and commit unless there are changes #264 2023-09-25 14:55:00 -07:00
Paul Gauthier
1334392418 lint 2023-09-01 15:53:19 -07:00
Joshua Vial
0826e116da cleaning up openrouter code 2023-08-23 22:03:09 +12:00
Joshua Vial
668a0500ff test openrouter model properties 2023-08-23 21:50:00 +12:00
Joshua Vial
d1e0a196b5 Add test for creating models from OpenRouter API. 2023-08-23 21:32:00 +12:00
Joshua Vial
abbc93678b finishing openrouter integration 2023-08-23 21:26:27 +12:00
Paul Gauthier
5c538327c3 update tests 2023-08-19 07:23:00 -07:00
Paul Gauthier
ae8d04a95f Handle diff of file not yet part of repo 2023-08-18 13:20:27 -07:00
Paul Gauthier
2737cbde06 ssh 2023-08-18 10:35:42 -07:00
Paul Gauthier
285536105e Properly handle all diff cases 2023-08-18 10:07:47 -07:00
Paul Gauthier
7af82ba185 keep track of the files which need dirty commits 2023-08-18 09:50:18 -07:00
Paul Gauthier
752e47a886 better tests, small cleanups 2023-08-18 09:43:40 -07:00
Paul Gauthier
95fb55b9d9 test_gpt_edit_to_dirty_file 2023-08-18 09:17:07 -07:00
Paul Gauthier
93795c085a make sure newly created files don't just get committed 2023-08-18 08:01:14 -07:00
Paul Gauthier
83f084a800 aider: Added assertion to check if repo.iter_commits(repo.active_branch.name) raises git.exc.GitCommandError.
# Aider chat conversation:

ASSISTANT: I understand that you want to complete the TODO task in the `test_new_file_edit_one_commit` method in the `tests/test_coder.py` file. However, the task is not clear. The TODO comment says:

```python
### TODO: assert that the next line raises git.exc.GitCommandError
```

This suggests that the following line of code should raise a `git.exc.GitCommandError` exception:

```python
repo.iter_commits(repo.active_branch.name)
```

To complete this task, we need to add a test assertion that checks if this line of code raises the `git.exc.GitCommandError` exception. We can use the `assertRaises` method from the `unittest.TestCase` class to do this.

Here is the change that needs to be made:

<source>python
tests/test_coder.py
<<<<<<< HEAD
            ### TODO: assert that the next line raises git.exc.GitCommandError
            repo.iter_commits(repo.active_branch.name)
=======
            with self.assertRaises(git.exc.GitCommandError):
                repo.iter_commits(repo.active_branch.name)
>>>>>>> updated
</source>

This change will add an assertion that checks if the `repo.iter_commits(repo.active_branch.name)` line of code raises a `git.exc.GitCommandError` exception. If the line of code does not raise this exception, the test will fail.
2023-08-18 08:00:04 -07:00
Paul Gauthier
f722394db6 Assert that the file exists before iterating through commits. 2023-08-18 08:00:03 -07:00
Paul Gauthier
d09e85adc2 Also ensure commit msg only depends on diffs from the GPT edited file. 2023-08-18 07:55:42 -07:00
Paul Gauthier
b7cb006958 test_only_commit_gpt_edited_file 2023-08-18 07:52:25 -07:00
Paul Gauthier
1460cd0055 test_new_file_edit_one_commit 2023-08-18 07:46:39 -07:00
Paul Gauthier
14d19e22b2 improved tests 2023-08-17 11:28:43 -07:00
Paul Gauthier
17c275b987 improved tests 2023-08-17 11:23:45 -07:00
Paul Gauthier
3401395e61 fix wholefile tests 2023-08-17 11:08:50 -07:00
Paul Gauthier
6c2923ff70 remove test for should_dirty_commit 2023-08-17 10:43:12 -07:00
Paul Gauthier
6e9fbdcb6a fixed spurious "Adding to git" messages when running aider in subdir of repo 2023-08-17 08:32:44 -07:00
Paul Gauthier
fed24aa444 lint 2023-08-10 16:53:34 -03:00
Paul Gauthier
a1da6cab24 ensure we diff properly in all cases, with tests #191 2023-08-10 15:33:53 -03:00
Paul Gauthier
7924900bc4 updated tests, disabled send cache 2023-08-10 12:27:46 -03:00
Paul Gauthier
77be993708 Merge branch 'main' into indent-bad-edit 2023-08-08 12:43:57 -03:00
Paul Gauthier
af854182dc added failing test case for diffs of empty repo with new file added 2023-08-08 08:20:26 -03:00
Paul Gauthier
20c7eb549c aider: Mocked get_commit_message to return "I added str(fname)".
# Aider chat conversation:

USER: mock `get_commit_message` to return "I added str(fname)"

ASSISTANT: To mock the `get_commit_message` method to return "I added str(fname)", we need to modify the `test_new_file_commit_message` function in the `tests/test_coder.py` file.

Here is the change needed:

<source>python
tests/test_coder.py
<<<<<<< ORIGINAL
            # Get the latest commit message
            commit_message = repo.head.commit.message
            # Check that the latest commit message contains the filename
            self.assertIn(str(fname), commit_message)
=======
            # Mock the get_commit_message method to return "I added str(fname)"
            repo.get_commit_message = MagicMock(return_value=f"I added {str(fname)}")
            # Get the latest commit message
            commit_message = repo.get_commit_message()
            # Check that the latest commit message is "I added str(fname)"
            self.assertEqual(commit_message, f"I added {str(fname)}")
>>>>>>> UPDATED
</source>
2023-08-08 08:01:15 -03:00
Paul Gauthier
737c2e0b5f aider: Check that the latest commit message contains the filename.
# Aider chat conversation:

USER: do the todo

ASSISTANT: To complete the TODO task in the `test_new_file_commit_message` function, we need to check that the latest commit message contains the filename. We can do this by getting the latest commit message from the git repository and checking if the filename is in it.

Here is the change needed in the `tests/test_coder.py` file:

<source>python
tests/test_coder.py
<<<<<<< ORIGINAL
            # TODO: check that the latest commit message contains str(fname)
=======
            # Get the latest commit message
            commit_message = repo.head.commit.message
            # Check that the latest commit message contains the filename
            self.assertIn(str(fname), commit_message)
>>>>>>> UPDATED
</source>
2023-08-08 07:59:57 -03:00
Paul Gauthier
6f6ff03338 Merge branch 'main' into indent-bad-edit 2023-08-04 06:41:43 -03:00
Paul Gauthier
c271bfd932 Fixed /commit after repo refactor, added test coverage 2023-08-04 06:39:04 -03:00
Paul Gauthier
26ebc715eb works 2023-08-03 16:22:49 -03:00
Paul Gauthier
e60a332fda go for the full line match first 2023-08-03 14:59:59 -03:00
Paul Gauthier
004c0529c6 keepends 2023-08-03 14:56:29 -03:00
Paul Gauthier
ae9f42ef8a test from main entrypt 2023-08-03 14:43:42 -03:00
Paul Gauthier
b0b83034e5 undo 2023-08-03 14:42:28 -03:00
Paul Gauthier
333a2e5b84 test from the main entrypoint 2023-08-03 14:40:31 -03:00
Paul Gauthier
832259b55b Bugfix reference to self.get_tracked_files, plus test coverage 2023-07-27 06:55:06 -03:00
Paul Gauthier
c8f1c0609d tests and bugfix 2023-07-24 17:47:53 -03:00
Paul Gauthier
cac627ae5f aider: Add None as the third argument in all calls to GitRepo.
# Aider chat conversation:

USER: `GitRepo` now takes a 3rd arg. add None as the missing arg in all calls

ASSISTANT: To add `None` as the third argument in all calls to `GitRepo`, we need to modify the `tests/test_repo.py` file.

Here are the changes:

```python
tests/test_repo.py
<<<<<<< ORIGINAL
        repo = GitRepo(InputOutput(), None)
=======
        repo = GitRepo(InputOutput(), None, None)
>>>>>>> UPDATED
```

```python
tests/test_repo.py
<<<<<<< ORIGINAL
        repo = GitRepo(InputOutput(), None)
=======
        repo = GitRepo(InputOutput(), None, None)
>>>>>>> UPDATED
```

```python
tests/test_repo.py
<<<<<<< ORIGINAL
        repo = GitRepo(InputOutput(), None)
=======
        repo = GitRepo(InputOutput(), None, None)
>>>>>>> UPDATED
```

```python
tests/test_repo.py
<<<<<<< ORIGINAL
        tracked_files = GitRepo(InputOutput(), [tempdir]).get_tracked_files()
=======
        tracked_files = GitRepo(InputOutput(), [tempdir], None).get_tracked_files()
>>>>>>> UPDATED
```

```python
tests/test_repo.py
<<<<<<< ORIGINAL
            git_repo = GitRepo(InputOutput(), None)
=======
            git_repo = GitRepo(InputOutput(), None, None)
>>>>>>> UPDATED
```
2023-07-24 17:32:09 -03:00
Paul Gauthier
94a271d522 Merge branch 'main' into refactor-repo 2023-07-24 14:24:20 -03:00
Paul Gauthier
66da82094d use index.entries 2023-07-24 13:47:33 -03:00
Paul Gauthier
bef1d00ab1 Refactor test_get_tracked_files_with_new_staged_file to use a GitTemporaryDirectory and add new assertions. 2023-07-24 13:42:05 -03:00
Paul Gauthier
e52807b868 cleanup 2023-07-23 10:31:59 -03:00
Paul Gauthier
143ca36733 Merge branch 'main' into refactor-repo 2023-07-23 10:23:38 -03:00