Commit graph

165 commits

Author SHA1 Message Date
Paul Gauthier
0cc00f2a1e Removed setting and restoring GIT_COMMITTER_NAME in GitRepo class. 2024-06-18 08:15:02 -07:00
Paul Gauthier
40c28ff7d8 aider: Set committer name to include "aider" and restore original committer name after commit. 2024-06-18 08:11:54 -07:00
Paul Gauthier
01242b256c Set committer name to include "aider" and restore original committer name after commit. 2024-06-18 08:11:53 -07:00
Paul Gauthier
6216a273fe drop context at the caller 2024-06-11 13:33:46 -07:00
Paul Gauthier
20f730a673 stop including chat conversation in commits 2024-06-11 13:19:02 -07:00
Paul Gauthier
7b8e603249 aider: Shortened the docstring in aider/repo.py to comply with the 100 characters line length limit.
# Aider chat conversation:

USER: I ran this command:

 pre-commit run --files aider/repo.py

And got this output:

isort....................................................................Passed
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

aider/repo.py:247:101: E501 line too long (111 > 100 characters)
        """
        Returns a list of all files which are dirty (not committed), either staged or in the working directory.
        """

                                                                                        ^

ASSISTANT: Please add the file `aider/repo.py` to the chat so I can make the necessary changes.

USER: I added these files to the chat: aider/repo.py

ASSISTANT: To fix the flake8 error, we need to shorten the docstring to comply with the line length limit of 100 characters.

Here is the *SEARCH/REPLACE* block:

aider/repo.py
```python
<<<<<<< SEARCH
        """
        Returns a list of all files which are dirty (not committed), either staged or in the working directory.
        """
=======
        """
        Returns a list of all files which are dirty (not committed), either staged or in the working
        directory.
        """
>>>>>>> REPLACE
```
2024-05-18 18:30:51 -07:00
Paul Gauthier
abbe5416a1 Refactored GitRepo class to use consistent quotation marks for git commands. 2024-05-18 18:30:50 -07:00
Paul Gauthier
5d8ed278aa aider: Add get_dirty_files() method to return all dirty files staged or in the working directory.
# Aider chat conversation:

USER: add a get_dirty_files() method which returns all the files which are dirty (not committed) either staged or in the working dir.

ASSISTANT: To add the `get_dirty_files()` method, we need to:

1. Define the new method in the `GitRepo` class.
2. Implement the logic to return all dirty files, both staged and in the working directory.

Here is the *SEARCH/REPLACE* block:

aider/repo.py
```python
<<<<<<< SEARCH
    def is_dirty(self, path=None):
=======
    def get_dirty_files(self):
        """
        Returns a list of all files which are dirty (not committed), either staged or in the working directory.
        """
        dirty_files = set()

        # Get staged files
        staged_files = self.repo.git.diff('--name-only', '--cached').splitlines()
        dirty_files.update(staged_files)

        # Get unstaged files
        unstaged_files = self.repo.git.diff('--name-only').splitlines()
        dirty_files.update(unstaged_files)

        return list(dirty_files)

>>>>>>> REPLACE
```

aider/repo.py
```python
<<<<<<< SEARCH
        return self.repo.is_dirty(path=path)
=======
        return self.repo.is_dirty(path=path)
>>>>>>> REPLACE
```
2024-05-18 18:13:08 -07:00
Paul Gauthier
b882d5db4c Do not require gpt-3.5 in GitRepo 2024-04-20 09:47:43 -07:00
Paul Gauthier
4e50f0d095 Support weak_model=False 2024-04-19 14:05:58 -07:00
Paul Gauthier
f81b62dfea Added --require-model-info 2024-04-19 14:01:02 -07:00
Paul Gauthier
f0f0c330d7 cleanup 2024-04-19 12:14:58 -07:00
Paul Gauthier
733c09d30f fixed test_repo 2024-04-18 14:55:56 -07:00
Paul Gauthier
c770fc4380 cleaned up client refs 2024-04-17 15:47:07 -07:00
Paul Gauthier
f1a31d3944 pass in commit models to gitrepo 2024-04-17 15:41:30 -07:00
Paul Gauthier
a84b4f8144 Add the ability to add images that are located outside the git repo #519 2024-04-12 08:26:49 -07:00
Paul Gauthier
c2b8b2355d Handle diffs on a detached head #520 2024-04-12 08:26:49 -07:00
Paul Gauthier
6dd5ae69e3 Normalize paths before checking aiderignore #479 2024-02-25 15:54:57 -08:00
Paul Gauthier
a9fe4532c7 Aider should fully ignore files in aiderignore #479 2024-02-24 09:39:33 -08:00
Christopher Toth
ba87510db1 Fix issue with path normalization that was causing files to be marked dirty on Windows when they were not 2023-12-29 13:04:46 -05:00
Paul Gauthier
57ab2cc9da Revert "implement deployment id"
This reverts commit b107db98fa.
2023-12-06 09:20:53 -08:00
Paul Gauthier
b107db98fa implement deployment id 2023-12-05 11:31:17 -08:00
Paul Gauthier
2ed0c8fb66 fixed test_repo 2023-12-05 10:58:44 -08:00
Paul Gauthier
fb07b784f6 move to gpt-3.5-turbo-1106 2023-12-05 10:28:27 -08:00
Paul Gauthier
6ebc142377 roughed in openai 1.x 2023-12-05 07:37:05 -08:00
Paul Gauthier
5756812938 Adopt subprocess.run(shell=True) for /git 2023-10-18 12:37:39 -07:00
Paul Gauthier
1085549548 Give up testing aiderignore caching in github actions 2023-10-18 12:28:24 -07:00
Paul Gauthier
df27007c00 wtf 2023-10-18 12:22:01 -07:00
Paul Gauthier
1a2370f9ae sleep in the test 2023-10-18 12:15:11 -07:00
Paul Gauthier
b87c9f14fb put back caching, add debug output 2023-10-18 12:11:07 -07:00
Paul Gauthier
d1cd0f9860 do not cache aiderignore 2023-10-18 12:06:47 -07:00
Paul Gauthier
cf00037442 st_mtime_ns? 2023-10-18 12:04:09 -07:00
Paul Gauthier
a1cb6e4e7a More paranoid mtime check 2023-10-18 11:55:04 -07:00
Paul Gauthier
2e6c785c3b cache aiderignore 2023-10-18 10:39:07 -07:00
Paul Gauthier
583c3285ec added tests, fixed bug 2023-10-18 10:31:45 -07:00
Paul Gauthier
9725b236a3 roughed in .aiderignore 2023-10-18 10:26:43 -07:00
Paul Gauthier
f8e30ad7a0 aider: Added import for pathspec library and implemented filter_ignored_files method to filter filenames according to gitignore type specifications in self.aider_ignore_file.
# Aider chat conversation:

ASSISTANT: To implement the `filter_ignored_files` method, we need to use the `pathspec` library to filter the filenames according to the gitignore type specifications in `self.aider_ignore_file`.

The `pathspec` library is not currently imported in the `repo.py` file, so we need to add that import.

We also need to read the `aider_ignore_file` and use its contents to create a `pathspec` that we can use to filter the filenames.

Here are the changes:

```python
aider/repo.py
<<<<<<< HEAD
import os
from pathlib import Path, PurePosixPath

import git

from aider import models, prompts, utils
from aider.sendchat import simple_send_with_retries

from .dump import dump  # noqa: F401
=======
import os
import pathspec
from pathlib import Path, PurePosixPath

import git

from aider import models, prompts, utils
from aider.sendchat import simple_send_with_retries

from .dump import dump  # noqa: F401
>>>>>>> updated
```

```python
aider/repo.py
<<<<<<< HEAD
    def filter_ignored_files(self, fnames):
        if not self.aider_ignore_file:
            return

        # todo: use pathspec to filter fnames according to the gitignore type specs in self.aider_ignore_file
=======
    def filter_ignored_files(self, fnames):
        if not self.aider_ignore_file:
            return fnames

        with open(self.aider_ignore_file, 'r') as f:
            ignore_spec = pathspec.PathSpec.from_lines('gitwildmatch', f)

        return [fname for fname in fnames if not ignore_spec.match_file(fname)]
>>>>>>> updated
```

Please note that these changes assume that `self.aider_ignore_file` is a path to a file containing gitignore-style patterns, one per line. If `self.aider_ignore_file` is not in this format, the code may need to be adjusted.
2023-10-18 10:24:54 -07:00
Paul Gauthier
10f2e114c5 Added a new parameter aider_ignore_file to the __init__ method of GitRepo class and added a new method filter_ignored_files to filter files based on gitignore type specs. 2023-10-18 10:24:52 -07:00
Paul Gauthier
6d5827643f don't try and commit unless there are changes #264 2023-09-25 14:55:00 -07:00
JV
041f3a4a38 initial code for working with openrouter 2023-08-23 14:39:12 +12:00
Paul Gauthier
ae8d04a95f Handle diff of file not yet part of repo 2023-08-18 13:20:27 -07:00
Paul Gauthier
285536105e Properly handle all diff cases 2023-08-18 10:07:47 -07:00
Paul Gauthier
752e47a886 better tests, small cleanups 2023-08-18 09:43:40 -07:00
Paul Gauthier
e608a351f0 standardize on abs_root_path(), simplify get/apply_edit 2023-08-18 07:20:15 -07:00
Paul Gauthier
8f26c27921 just diff the named files on commit 2023-08-18 07:09:16 -07:00
Paul Gauthier
389bf9310c commit just the edited files, treat named files outside git as dirty 2023-08-18 07:05:48 -07:00
Paul Gauthier
d89316147a do not add new files to git 2023-08-17 16:31:21 -07:00
Paul Gauthier
d981de5f5f do the commit before applying edits 2023-08-17 10:40:01 -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
a1da6cab24 ensure we diff properly in all cases, with tests #191 2023-08-10 15:33:53 -03:00