Simply update the _default_version variable when creating new
releases instead of having all of the extra code for parsing the
version from git. This removes a lot of complexity.
Signed-off-by: David Aguilar <davvid@gmail.com>
The selection behavior changed in 952029b197
to not select items as they travel from staged to unstaged, and
vice versa. This improved usability but interfered with the
partial staging workflow because partially staged files
were not re-selected. Similarly, selecting multiple files and
hitting 'rescan' would lose the selection.
Improve these cases by reselecting files from the same
staged/unstaged category when they were previously selected.
This still addresses the usability issue from #97 because
we do not restore selection across the staged/unstaged boundary.
Further improve the interaction by optimizing the selection
behavior for code reviews. When an unstaged item is staged
(and vice versa), the next item is automatically selected.
Closes#97
Signed-off-by: David Aguilar <davvid@gmail.com>
Guard against deadlocks and other possible errors encountered
during low-memory conditions. The trace variables were also
consolidated in this simplification pass.
Signed-off-by: David Aguilar <davvid@gmail.com>
Previously, git-dag would find the directory two up from the running
file and append some path components to it without reference to the
filesystem. When git-cola (and hence __file__) was a symlink this
would break, causing the application to fail to find its own
libraries. Instead, resolve any symlink using os.path.realpath at the
beginning, before any path manipulation.
Previously, git-cola would find the directory two up from the running
file and append some path components to it without reference to the
filesystem. When git-cola (and hence __file__) was a symlink this
would break, causing the application to fail to find its own
libraries. Instead, resolve any symlink using os.path.realpath at the
beginning, before any path manipulation.
git-cola attempts to maintain the selection after staging files.
This makes the tree view hard to use because the modified area
keeps losing focus.
Keep the newly-staged item unselected so that the scrollbars do not
change location. This makes it easier to review and stage many files.
Closes#97
Signed-off-by: David Aguilar <davvid@gmail.com>
cola/__init__.py is what we're *really* interested in so check for its
existence instead of blindly checking for a directory called 'cola'.
Signed-off-by: David Aguilar <davvid@gmail.com>
We do not need to ship these now that we depend on either python 2.6's
json module or an external simplejson.
Signed-off-by: David Aguilar <davvid@gmail.com>
Replace the bookmarks dialog with a simpler version that does not depend
on QObserver. Use the simpler Settings class to remove unnecessary
dependencies.
Signed-off-by: David Aguilar <davvid@gmail.com>
Replace all QtGui.QApplication.instance().activeWindow() call
sites with qtutils.active_window().
We can later go through and eliminate the 'parent' argument to
many of the callbacks by calling active_window() instead of
passing it along.
Signed-off-by: David Aguilar <davvid@gmail.com>
The UI command wrappers originally required a parent widget for use
when creating dialogs, etc. Use qtutils.active_window() instead so
that the command wrappers can be installed without needing to keep
a reference to the top-level widget.
Signed-off-by: David Aguilar <davvid@gmail.com>
The revselect module is only used in one place so remove the extra module.
Simplify the layouts by using QLayout.addStretch() instead of manually
creating spacer items.
Signed-off-by: David Aguilar <davvid@gmail.com>
Build a filesystem tree from a list of file paths and provide a
dialog for choosing a path from the list. This will replace
the guicmds.choose_from_list() function.
Signed-off-by: David Aguilar <davvid@gmail.com>
Create a generic list-based model and build GitTreeModel using it.
GitTreeModel contains the specific details about 'git ls-tree'.
GitFileListModel is able to build a tree structure from a list
of paths. This feature will be used to replace the ListView class.
Signed-off-by: David Aguilar <davvid@gmail.com>
The "Select File" listview widget will be replaced by a nicer
QStandardItemModel-based dialog which reuses the BrowseDialog.
Factor out its current model so we can plug others in.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'Delete File(s)' action presents a confirmation dialog
so its menu entries should have a '...' suffix.
Signed-off-by: David Aguilar <davvid@gmail.com>
Refer to the action of 'Undoing changes' as 'Reverting' since
it is easier to understand.
Add beautiful icons to the context menus.
Change the last remaining 'Yes/No' questions to action-centric
confirmation dialogs.
Signed-off-by: David Aguilar <davvid@gmail.com>
Refer to 'Hunks' as 'Sections' since that is more intuitive to
those who are not diff/patch/git experts.
Add beautiful icons to the context menu actions.
Change the last remaining 'Yes/No' question to a more intuitive
action-centric confirmation dialog.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were calling rstrip() which is a no-op when the bytes we want
to strip are NULL. Strip NULL explicitly so that we can do
without the extra check at the start of the loop.
Signed-off-by: David Aguilar <davvid@gmail.com>
e593b390f2 removed the --style
option so widgets no longer need to support custom properties
for use by stylesheets.
Signed-off-by: David Aguilar <davvid@gmail.com>
[test]
bool
Is considered 'true' by 'git config --bool test.bool'.
These are rare in practice but we should honor them.
Likewise, make sure that we probably handle:
[test]
value =
Improve the gitcfg handling for bool values.
Add tests to cover these both of these cases.
Signed-off-by: David Aguilar <davvid@gmail.com>
Remove the [brackets] to make the branch name easier to read.
Make the git-dag window title useful at a glance.
Signed-off-by: David Aguilar <davvid@gmail.com>
Things look nice when git-cola follows the system theme.
Remove the unnecessary and seldom-used --style option.
Simplify the icon lookup code so that it uses Qt's resource
directories. This lets us name icons using, e.g., 'icons:foo.png'
instead of supplying an absolute path.
Signed-off-by: David Aguilar <davvid@gmail.com>
We originally ran "git diff --exit-code <path>" against every
modified file to detect "partially-staged" files.
Simplify the code so that we only ever call two git commands to
gather staged and modified files. This eliminates one git call
on startup in the best case and many calls in the worst case
when many files have been modified.
We may later want to split out the diff_upstream(head) call so
that it is invoked by the classic view only since it is not used
anywhere else.
Signed-off-by: David Aguilar <davvid@gmail.com>
The most frequently used items such as 'Stage' and 'Unstage' should be
listed before less-frequently used items such as 'Rescan'.
Closes#95
Signed-off-by: David Aguilar <davvid@gmail.com>
We previously checked whether .gitignore was checked into the repository
before writing to it. It is faster and more robust to simply check if
the file exists. This prevents git-cola from overwriting .gitignore
when it has not been added to git.
Closes#94
Signed-off-by: David Aguilar <davvid@gmail.com>
Highlight the completed text to visually indicate matches.
Change the match style so that it searches the entire entry
for a possible match instead of matching against the beginning
of the string only.
Add icons to show whether the match is a ref, file, or directory.
Signed-off-by: David Aguilar <davvid@gmail.com>
We may be temporarily out of memory and thus unable to start
new sub-processeses. Detect this condition and retry.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes the context menu overloading simpler since
we simply re-implement events instead of monkey-patching
them from the context of its containing widget.
The end result is simpler and easier to follow.
Signed-off-by: David Aguilar <davvid@gmail.com>
Prompting should be a preference but for now let's guard
against eager cat-paws. This is a dangerous feature, after all.
Signed-off-by: David Aguilar <davvid@gmail.com>
There are times with 'git apply --index' fails but
'git apply' does not so allow the checkbox used for 'save'
to also affect the 'apply' operation.
Signed-off-by: David Aguilar <davvid@gmail.com>
Avoid ambiguous shortcut overloads by using 'Ctrl+R' directly
and avoiding the platform-dependent QKeySequence.Refresh.
One some platforms QKeySequence.Refresh != 'Ctrl+R' and the
shortcut is not overloaded there. On Linux they are equal
which is what creates the overloaded shortcut.
Signed-off-by: David Aguilar <davvid@gmail.com>
Our tarballs do not need to include the extra "version"
file anymore so remove the unnecessary steps from the dist target.
This target won't really be used anymore since we are just
publishing the repo as-is without any post-processing of the
output of "git archive", but it's still nice to have.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now keep a default version in the 'version.py' file
so avoid relying on the extra step of creating a 'version'
file at the root of the project.
Signed-off-by: David Aguilar <davvid@gmail.com>
The text input field can now be used like a command-line
whose arguments are passed along to "git log".
This allows us to slice and dice history using the standard
gitcli(1) shell syntax.
The GUI now displays "git log -# [...]" which is familiar and
powerful for git users.
Signed-off-by: David Aguilar <davvid@gmail.com>
The DAG view accepts arbitrary options such as
"master -- Makefile" which are passed along to "git log".
This means that much of the history can be missing.
Adjust the commit generation numbers according to a simple counter
for commits adjacent to missing history.
Signed-off-by: David Aguilar <davvid@gmail.com>
Qt 4.6 does not provide QtGui.QKeySequence.Preferences; add it.
Guard against duplicate shortcut definitions by uniqifying the list.
Signed-off-by: David Aguilar <davvid@gmail.com>
Add an item to the context menu for loading previous commit mesages.
Five items are displayed. Additional message can be selected by
choosing the "More..." menu item.
Closes#33
Signed-off-by: David Aguilar <davvid@gmail.com>
Remove the old stash dialog and stash-related methods from
the main model. Switch to using the better stash dialog.
Signed-off-by: David Aguilar <davvid@gmail.com>
The stash dialog now has an inline stash viewer instead of
using the diff viewer from the main UI. It also uses the
simplified MVC architecture instead of depending on QObserver.
Signed-off-by: David Aguilar <davvid@gmail.com>
Handle setting the font during construction.
Factor out the read-only diff viewer into a standalone class.
Signed-off-by: David Aguilar <davvid@gmail.com>
Remove the global "instances" data structure since it is not
needed to prevent Python from garbage collecting the widget.
The widget is kept in scope naturally and thus does not need
us to keep an extra reference.
Signed-off-by: David Aguilar <davvid@gmail.com>
Add a QLineEdit-derived widget that comes with a GitRefCompleter
built-in. This lets us avoid repeating the same setup code in
various places.
Signed-off-by: David Aguilar <davvid@gmail.com>
There must be a bug in msysgit because setting the file
descriptors to binary does not allow NULL in git log's
output when using a %x00 in the format string.
Signed-off-by: David Aguilar <davvid@gmail.com>
The list widget items were one row too tall because the text
being shown ended with a newline. Call rstrip() after
readline() to remove it.
Signed-off-by: David Aguilar <davvid@gmail.com>
The DAG worked around stdout not returning binary data by using
0x01 instead of NULL as a separator in its "git log" format string.
Rework it so that the file descriptors are binary and use NULL in
the format string again.
Signed-off-by: David Aguilar <davvid@gmail.com>
There is no need to check the platform at runtime now that we
can rely on "git mergetool --no-prompt" being available.
Signed-off-by: David Aguilar <davvid@gmail.com>
This fleshes out the cola.merge package so that it contains the
customary model, view, and controller modules. This is a drop-in
replacement for old dialog.
Signed-off-by: David Aguilar <davvid@gmail.com>
This was a workaround for win32 which is no longer needed now that
we use subprocess when backgrounding commands.
Signed-off-by: David Aguilar <davvid@gmail.com>
We had a test case to prevent circular imports but it's pointless
and gets in the way when refactoring. It is not needed since we
will simply not introduce any circular imports.
Signed-off-by: David Aguilar <davvid@gmail.com>
This removes all of the confusing and problematic win32 hacks
by using the simple Popen(cmd].pid pattern.
Signed-off-by: David Aguilar <davvid@gmail.com>
Use a QStringListModel internally instead of setting the list of
revisions during object construction. Subscribe to the model's
"updated" message so that changes to the git data is reflected
in the completer.
Signed-off-by: David Aguilar <davvid@gmail.com>
Minimize the number of clicks when editing preferences by using
a tab bar instead of a combo box.
Closes#89
Suggested-by: Paolo G. Giarrusso <Blaisorblade on github>
Signed-off-by: David Aguilar <davvid@gmail.com>
The main entry point now lives at cola.app.main() instead of
cola.main.main() to package name conflicts.
This is the first step towards reorganizing the project into
separate packages for each tool/dialog.
Signed-off-by: David Aguilar <davvid@gmail.com>
The new preferences dialog is simpler and does not depend on the
(deprecated) QObserver controller class.
Closes#89
Signed-off-by: David Aguilar <davvid@gmail.com>
Centralize all of the preferences for fonts into the prefs module
and use it instead of the qtutils function.
Signed-off-by: David Aguilar <davvid@gmail.com>
Make everything notification-based so the main view does not depend
on the QObserver magic. The diff viewer and commit message editor are
now completely independent widgets that are only loosely coupled to
the main window.
Signed-off-by: David Aguilar <davvid@gmail.com>
Make the main window know nothing about the diff viewer by
moving all of the diff editing functionality into a standalone
DiffTextEdit widget.
Signed-off-by: David Aguilar <davvid@gmail.com>
Remove the unnecessary 'Edit' menu from the main menu bar.
The 'Options' action moved into the 'File' menu since the
'Edit' menu is empty without Cut/Paste/etc.
Centralize all of the action handling code into views.mainwindow.
Do not register any actions for Copy/Paste/etc. whatsoever so that
the Qt defaults (which do the right thing) are used instead.
This is the simpler thing to do, uses less code, makes a nicer UI,
and fixes being able to use Ctrl+C in the diff viewer.
It also reduces confusion because it is not clear for new users whether
the edit menu operates on the commit message editor or on the diff viewer.
Likewise, leaving the Ctrl+C, etc. keyboard shortcuts alone allows
Qt to use the correct widget-context action (which happens by default).
This is a net reduction of ~100 lines of code. yay :-)
Closes#90
Signed-off-by: David Aguilar <davvid@gmail.com>
Refer to scene items as "items" and commit nodes as Commits consistenly.
This makes the terminology consistent between the tree and graph widgets.
Signed-off-by: David Aguilar <davvid@gmail.com>
Keep track of commit SHA-1s in the GitDAGWidget so that we broadcast
a selection event to all listeners.
Signed-off-by: David Aguilar <davvid@gmail.com>
It is possible for a diff command to be issued with an empty
list of files. Guard against this condition so that we do not
generate a stacktrace and hang.
Closes#88
Signed-off-by: David Aguilar <davvid@gmail.com>
Avoid using GTK by using Qt's built-in QIcon.fromTheme().
Support older versions of Qt by catching AttributeError and
falling back to our built-in icons.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-difftool originated in git-cola and was later contributed to
the main git project's contrib/ section. It moved out of contrib/
in git v1.6.3.
git-cola also uses "git mergetool --no-prompt" and "git diff --patience"
which both appeared in v1.6.2.
Remove our version of difftool and depend on git >= v1.6.3 so that
we do not have to maintain these scripts anymore. Remove the runtime
checks for "mergetool --no-prompt" and "diff --patience" now that the
entire project depends on a modern git.
Signed-off-by: David Aguilar <davvid@gmail.com>
The "max results" spinbox and "revision" line edit now control
the displayed history. The "Display" button clears the graph
and starts a new query.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were sending commits from the reader thread once per commit.
This floods the main GUI with signals. Throttle it back by
processing commits in larger chunks.
Signed-off-by: David Aguilar <davvid@gmail.com>
The label drawing code was originally part of the Node item class.
This had the negative side-effect that clicking on the label would
select the node even when the node contained no labels.
Use a separate, non-selectable, QGraphicsItem subclass for labels.
Make it a child of the node so that it can be positioned relative
to the node's position in the scene graph.
Signed-off-by: David Aguilar <davvid@gmail.com>
Use prettier colors when drawing the DAG.
Adjust item sizes to make things fit together more closely.
Use class attributes to avoid creating creating colors in every
instance of the Node class.
Use a simple calculation based on a commit's generation number
to determine its (x, y) location in the scene.
Signed-off-by: David Aguilar <davvid@gmail.com>
The generation number is a robust and simple property we can use
when drawing the DAG. Change the "git log" command so that it
lists commits in reverse-topological order. This allows us to
track generation numbers while building the graph incrementally.
Signed-off-by: David Aguilar <davvid@gmail.com>
Sometimes python's LIBDIR is not the same as the lib/ directory used by
distutils so change the Makefile so that it uses lib*.
Signed-off-by: David Aguilar <davvid@gmail.com>
The task manager holds references to individual tasks to prevent Python's
garbage collector from reaping running tasks, which causes a segfault.
Signed-off-by: David Aguilar <davvid@gmail.com>
GitRepoModel._create_dir_entry() gets called many times for large repos so avoid
expensive "." lookups where possible.
GitEntryManager.entry() now uses a local reference to its instance
dictionary to avoid doing extra Python name lookups.
Signed-off-by: David Aguilar <davvid@gmail.com>
Make sure the 'remote' section is always at the top and focused.
When doing 'pull', do not select a local branch by default.
This ensures that we do "git pull $remote" instead of
"git pull $remote $branch", which only updates the local
branch and leaves the remote tracking branch behind.
Signed-off-by: David Aguilar <davvid@gmail.com>
Change the "Yes" / "Cancel" confirmation buttons to say
"Stage and Commit" / "Cancel", which is clearer and more user-friendly.
Signed-off-by: David Aguilar <davvid@gmail.com>
Variables that are externally defined should use ALL_CAPS.
Internal variables should use small_caps.
The net effect is that command names and DESTDIR are the
only capitalized variables, which is simple and consistent.
Signed-off-by: David Aguilar <davvid@gmail.com>
The top-level Makefile depended on the existence of cola's
git repository to generate its version number.
Rework the Makefile so that the "make dist"-generated "version"
file is used instead. This is done by scraping the output of
"python cola/version.py", which knows to look for the "version"
file before trying to use "git describe".
Signed-off-by: David Aguilar <davvid@gmail.com>
stderr was not getting captured which meant that output from 'git apply'
was going to the shell. Capture stderr and log it instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
"Connecting" makes users think that we're trying to
establish a connection. We're really transferring data
to/from the remote so use that verb instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
The use of import user in settings.py causes anything in a user's
PYTHONSTARTUP script to execute. This can have unexpected side effects.
Use os.path.expanduser('~') instead of user.home.
Closes#86
Signed-off-by: David Aguilar <davvid@gmail.com>
Newer version of msysgit do not allow NULL in git's output so
use byte 0x01 as our separator instead.
Closes#85
Signed-off-by: David Aguilar <davvid@gmail.com>
"git push" uses remote.$remote.pushurl when configured so follow
the same rules when displaying the remotes.
Closes#83
Signed-off-by: David Aguilar <davvid@gmail.com>
We now call 'git update-index --refresh' on startup and in the 'Refresh'
command only.
The other commands call model.update_file_status() which avoids
updating the entire index, updating remotes, etc.
This shaves off a few unneeded git calls. The stage/unstage methods
previously included some performance hacks to avoid needing to rescan
for changes. These have been removed in favor of the simpler "just rescan"
logic. This will become less of an issue in the future when we do all
rescanning in a background thread.
An important note is that all of the editor commands call update_status()
explicitly instead of relying on the base class to call it for them.
This is better since it makes things more explicit.
Signed-off-by: David Aguilar <davvid@gmail.com>
Pass an explicit head when unstaging files with 'git reset'.
This makes unstaging files from the previous commit work correctly
since we do not always want to reset to the contents of 'HEAD'.
The net effect is that we now call 'git reset HEAD -- <paths>' for the
normal case and 'git reset HEAD~ -- <paths>' when amending a commit.
Closes#82
Signed-off-by: David Aguilar <davvid@gmail.com>
Add a 'parent' flag to qtutils.information() so that we can
parent the message box to the specified parent.
This makes the dialog appear centered relative to the parent.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds the ability to provide informative and details text in the
information() helper. A better icon is used as well.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'Search' menu actions moved into Actions->Grep and Commit->Search.
This eliminates an entire menu, which is good.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now disable unavailable actions, have a much nicer UI,
and provide prompts with more intuitive interfaces.
Death to the old stash dialog!
Signed-off-by: David Aguilar <davvid@gmail.com>
question() asks Yes/No questions which are not very user-friendly.
Dialog buttons should say things like 'Save', not 'Yes'.
confirm() allows the caller to supply the text and icon for the
confirmation button so that the interaction can be improved.
Signed-off-by: David Aguilar <davvid@gmail.com>
Registering on release() does not allow us to click, hold, and drag away
to prevent the action from triggering. clicked() is better because what
we really want to know is whether we were clicked, not whether the
release event arrived.
Signed-off-by: David Aguilar <davvid@gmail.com>
The status widget is constructed before its state is set so sometimes
cola may appear with its four top-level "Staged", "Unstaged",
"Unmerged", and "Untracked" items in an empty state before being
immediatley updated.
Avoid this by hiding the top-level items on first construction so that
they only appear later when the widget is populated.
Signed-off-by: David Aguilar <davvid@gmail.com>
Remove the global singleton since we don't really need it.
Create a normal instance in the main window instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
Disabling the parent widget disables the progress dialog on Mac OS X.
Work around this by explicitly enabling the progress dialog
after disabling the parent dialog.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes the interaction much nicer by giving feedback during the
remote fetch, push, and pull operations.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes the remote dialogs drop down in the context of the
main window. It also adds a cool animation.
Signed-off-by: David Aguilar <davvid@gmail.com>
"git push" might fail but we provide no indication of this to
the user. Show a helpful error message when this happens.
Closes#69
Signed-off-by: David Aguilar <davvid@gmail.com>
Porting cola to python3k will probably require a cola.compat
variable where we set unicode = str. Or not. It'd be nice
to support both 2 and 3 with the same codebase, but maybe
that's crazy. :-/
Signed-off-by: David Aguilar <davvid@gmail.com>
The path to .git/MERGE_MSG may contain unicode characters so decode
it before trying to read the file.
Closes#74
Signed-off-by: David Aguilar <davvid@gmail.com>
We were not properly handling repositories with unicode in
their paths for the "git init" case. We read .git/HEAD directly
and thus need to decode the path to .git/HEAD since its parent
directory may contain unicode characters.
Closes#74
Signed-off-by: David Aguilar <davvid@gmail.com>
git-cola assumes that the current directory is a git repository.
This is less helpful when launching git-cola through a launcher icon
because it may find a git repository in $HOME.
Add a '--prompt' flag and use it in all of the launchers.
This forces git-cola to prompt the user for a repository before
launching the main GUI.
Closes#75
Signed-off-by: David Aguilar <davvid@gmail.com>
Both the user's home directory and the repository directory can
contain unicode characters in their path. Decode inputs from
the filesystem so that these paths are accepted.
Closes#74
Signed-off-by: David Aguilar <davvid@gmail.com>
We needed 'commands' back when we built our own strings using
'commands.mkarg()'. We now use subprocess.list2cmdline() instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
Newer versions of msysgit no longer require the win32_expandpaths()
hack to expand paths after the double-dash.
Remove this old hack to make newer gits happy.
This basically means we don't support the older msysgit which
required the workaround, which is fine. If we find someone is
still using an old version we can always add a check later.
Signed-off-by: David Aguilar <davvid@gmail.com>
PyQt 4.6.2 segfaults if we don't hold onto a reference to our QRunnable tasks.
Python assumes they are unreferenced and safe to garbage collect.
Keep a reference to the task objects to prevent Python from garbage
collecting them.
Signed-off-by: David Aguilar <davvid@gmail.com>
Use QThreadPool to offload several git operations so that
git-cola starts up faster. We can later look into using
'git status --porcelain' to eliminate a few more git calls.
Signed-off-by: David Aguilar <davvid@gmail.com>
Loading configured actions can be expensive so do it in the background.
The actions module now returns config action names instead of doing
the menu updating itself. When QThreadPool is available we listen
for ''install_config_actions' and add callbacks for each name
sent to it.
Signed-off-by: David Aguilar <davvid@gmail.com>
Prepare to offload expensive operations onto a background thread
by making all of the observer-registered GUI callbacks thread-safe.
We do this by using Qt's signal/slots. When a callback happens in
another thread it simply posts a signal using emit().
The main (GUI) thread registers for these signals and handles
updating the views in response to the signals.
Signed-off-by: David Aguilar <davvid@gmail.com>
The ecmerge documentation mentions the following form:
ecmerge --mode=diff2 $1 $2
Since git-difftool is about diffing, we should use that instead
of --mode=merge2. Likewise, this drops the $MERGED argument to
emerge, as discussed on the git list ($gmane/117930).
Signed-off-by: David Aguilar <davvid@gmail.com>
Add error checking so that we can detect when users provide either
bad paths or unconfigured commit message templates.
Previously, an unconfigured "commit.template" git config variable
would result in a stacktrace. We now present users with a helpful
error message instead.
Closes#72
Signed-off-by: David Aguilar <davvid@gmail.com>
Prompt users when a 'UsageError' occurs. We currently use the simple
'information' callback. Different error classes can define fancier
ones later as needed.
Signed-off-by: David Aguilar <davvid@gmail.com>
Register known paths up front to avoid checks within a loop.
Updates timeouts so that we sleep for slightly longer.
We no longer use quit() when ending the inotify thread.
We call stop() and wait for it to complete. This allows us
to do without the setTerminationEnabled(True) call,
which is generally discouraged.
Signed-off-by: David Aguilar <davvid@gmail.com>
Ensure that we don't interfere with Qt's event processing by
unconditionally calling the default keyPressEvent() in our
custom callback.
Signed-off-by: David Aguilar <davvid@gmail.com>
The gitrepo QStandardItemModel checks fields in the model which were not
initialized in the 'git cola --classic' standalone case.
Scan the repository before initializing any GUIs so that all of the
model data is available beforehand.
Signed-off-by: David Aguilar <davvid@gmail.com>
QStandardItem only lets us set a single icon which is good enough for now.
The 'Untracked' text was made less cluttered by simply showing a '?' instead.
That way only the statuses with icons have text next to them.
Signed-off-by: David Aguilar <davvid@gmail.com>
This reverts commit 16e5126461.
When staging an upper-level folder using 'cola classic'
in ends up staging all the untracked files in that subdirectory.
Oops! Adding ignored files is an edge case and we don't need
to support it if it hurts the common case.
Signed-off-by: David Aguilar <davvid@gmail.com>
Re-initialize the data dictionaries directly instead of
calling reset(). This fixes git config caching since
the cache data isn't continually discarded.
Signed-off-by: David Aguilar <davvid@gmail.com>
Remove the unnecessary editor command for the 'signoff' action
so that the Qt widget can do the heavy lifting.
Signed-off-by: David Aguilar <davvid@gmail.com>
Incorporate Fedora's fix for the translations path.
This originally appeared in cola-1.4.3-translations.patch.
Patched-by: Kevin Kofler <Kevin@tigcc.ticalc.org>
Signed-off-by: David Aguilar <davvid@gmail.com>
If a file is .gitignore'd we are unable to add it because we are using
'git add' as-is. Pass '--force' so that we can stage files regardless
of whether they exist in .gitignore or not.
Signed-off-by: David Aguilar <davvid@gmail.com>
Slice the arguments passed on the command line so that staging a large
list of files does not error out with 'errno: Argument list too long'.
We do this by incrementally staging 42 files at a time.
Signed-off-by: David Aguilar <davvid@gmail.com>
Users might have Python installed in a path with a space in it
so guard against this possibility even if we don't check any
of those paths ourselves.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds the ability to have a dockable 'Cola Classic' tool.
This is enabled by setting the 'cola.classicdockable' configuration. e.g.:
git config cola.classicdockable true
The default is 'false' simply because it slows the down startup time
and is especially noticable on large repositories.
Closes#56
Signed-off-by: David Aguilar <davvid@gmail.com>
That function doesn't even exist. This is in error-handling that
only happens when you forcibly kill cola while loading the dag view.
Signed-off-by: David Aguilar <davvid@gmail.com>
If for whatever reason ~/.cola contains bad json cola won't startup.
Act as if the file didn't exist instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now ship separate installers for Qt/PyQt so we don't need to
ship them inside of git-cola.app anymore. This cuts down on the
OS X download size tremendously and allows us to ship a single
git-cola.app for all OS X platforms.
The only difference between platforms are the Qt/PyQt libraries
which are available as a separate download.
Signed-off-by: David Aguilar <davvid@gmail.com>
Paths with unicode are not supposed to hit the "else:" block in eval_path()
but guard against it anyways by decoding inputs and encoding outputs.
Closes#64
Signed-off-by: David Aguilar <davvid@gmail.com>
Refactor usage of 'git diff' to pass '--no-ext-diff'.
Avoid launching user-configured diff.external viewers by updating
the _common_diff_opts() function and ensuring that all git.diff
callers use it.
Closes#67
Signed-off-by: David Aguilar <davvid@gmail.com>
Avoid globals in the helper testlib so that every test
gets its own temp repository created by tempfile.mkdtemp().
Signed-off-by: David Aguilar <davvid@gmail.com>
When a node is clicked we copy display commit information and
copy its SHA-1 into the copy/paste buffer. This can be expanded
to have more functionality such as cherry-pick, format-patch, branch,
merge, rebase, etc.
Signed-off-by: David Aguilar <davvid@gmail.com>
This reverts commit 544032b2d6.
Arch's default 'python' is python3k so prepare for this by
re-enabling distutil's shebang line replacement.
This allows packagers to supply the $(PYTHON) variable
to 'make' and have it do the right thing. e.g.:
make PYTHON=python2 prefix=/usr install
This causes the installed 'git-cola' script to have have
the correct shebang line.
Closes#66
Reported-by: alyst via github.com
Signed-off-by: David Aguilar <davvid@gmail.com>
Ask python for the default LIBDIR and use that to calculate the
path to the leftover eggs produced by distutils.
Signed-off-by: David Aguilar <davvid@gmail.com>
We wrap the status view's QTreeWidget mouse release event to clear the
selection when clicking in an empty area. We were not calling the
wrapped objecct's original event handler which caused odd behavior
in newer versions of PyQt. Call into the original handler to get
the correct behavior.
Signed-off-by: David Aguilar <davvid@gmail.com>
PyQt 4.7.3 no longer evaluates bool(layout) to True.
Thanks to the patient Ubuntu and Arch users who reported this problem.
Closes#62
Signed-off-by: David Aguilar <davvid@gmail.com>
Uri recommended we get rid of this.
It's confusing and disorienting to have different behavior
based on where you click on an item.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Uri Okrent <uokrent@gmail.com>
cola now creates annotated tags when a tag message is
supplied. Previously, cola allowed creating tag messages
creating signed tags only.
Signed-off-by: David Aguilar <davvid@gmail.com>
This reverts commit 73acd20d23.
I was reading bug #62 incorrectly.
They were talking about the actions _dialog_,
not the actions widget ;-)
Conflicts:
cola/views/mainwindow.py
Signed-off-by: David Aguilar <davvid@gmail.com>
PyQt4 4.7.4 loses its bearings when a widget modifies the
direction of its QBoxLayout in a resize event.
We depended on this behavior to allow the actions widget to
automatically switch between vertical and horizontal layouts.
Simplify the code by just sticking to a vertical layout.
All of the actions on the 'Actions' widget are also
available in the menus these days.
Closes#62
Reported-by: alyst via github.com
Signed-off-by: David Aguilar <davvid@gmail.com>
We can now stage or unstage all files by right-clicking on the
'Staged' or 'Unstaged' icons.
Closes#57
Suggested-by: Shish Moom <webmaster@shishnet.org> via github
Signed-off-by: David Aguilar <davvid@gmail.com>
Staging files one at a time is a pain; normally from the
command line I just do 'commit -a'.
A GUI equivalent would be nice. Instead of 'Commit' coming
back with 'There are no staged files die', it could say,
'There are no staged files.
Do you want to stage and commit all modified files?'
Closes#55
Signed-off-by: David Aguilar <davvid@gmail.com>
Having these available in the 'Actions' menu would be useful
and more intuitive. This also allows us to save some screen
real-estate since we no longer need the 'Actions' widget to
access these commands.
Closes#58
Signed-off-by: David Aguilar <davvid@gmail.com>
We were only calling i18n.install() when 'locale' was passed to
the ColaApplication constructor. We should call it unconditionally
otherwise we won't be able to translate anything.
Additionally, call i18n.gettext() in create_button() so that
the action buttons are translated too.
Signed-off-by: David Aguilar <davvid@gmail.com>
ssh-askpass's window sometimes freezes after the
password is typed. Each exit causes the window
to be destroyed again, resulting in a hang.
The destroy event might come from the window manager
so rebind <Destroy> inside of its handler before exiting.
Signed-off-by: David Aguilar <davvid@gmail.com>
This algorithm is slightly more appealing because it bends chains
of commits that lead to parallel branches.
It's not perfect, but it's one of the simpler things we can do
with the streaming one-node-at-a-time approach in use.
We could probably make a very nice layout by post-processing
the graph using a thread but it's not *that* bad, either.
Signed-off-by: David Aguilar <davvid@gmail.com>
There's no reason to do this in add_edge() since the information
is incomplete on the first call. We now handle calling adjust()
outside of add_edge(), so this call is unnecessary.
Signed-off-by: David Aguilar <davvid@gmail.com>
This allows us to lazy-load parent commits.
The advantage is that we now have parent commit objects that
are lazy-loaded with thier metadata.
Signed-off-by: David Aguilar <davvid@gmail.com>
Patches are required to be without CRLF endings
so open/write files in binary mode.
Closes#53
Signed-off-by: Michael Geddes <michael@frog.wheelycreek.net>
Signed-off-by: David Aguilar <davvid@gmail.com>
We don't need any of the function signature-mangling features
so let's just rewrite this code. This is also faster since it
no longer needs the 're' and 'inspect' modules.
Signed-off-by: David Aguilar <davvid@gmail.com>
shape() and boundingRect() were heavy hitters when profiling the
'git dag' using cProfile. Use memoize() to optimize away their
expensive calculations.
Signed-off-by: David Aguilar <davvid@gmail.com>
Eliminate more local caches in favor of the memoize() solution.
This makes the code easier to read and simpler in implementation.
Signed-off-by: David Aguilar <davvid@gmail.com>
We probably don't gain too much by memoizing is_win32() but it
probably doesn't hurt to shave off an instruction or two either.
Signed-off-by: David Aguilar <davvid@gmail.com>
This eliminates all of the module globals by using memoize().
The code is simpler too since it does not have to handle caching.
Signed-off-by: David Aguilar <davvid@gmail.com>
http://en.wikipedia.org/wiki/Memoization
We're including code from python-decorator for ease of installation.
Our addition is the memoize() decorator. memoize() will allow us to
simplify many of our singleton factory methods.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-gui uses 'sh -c $cmd' when implementing menu commands.
Passing shell=True works fine on Linux, but on Windows
it goes through cmd.exe, which is not the shell we want
to use.
Always use 'sh -c' so that behavior is consistent
across platforms.
Signed-off-by: Michael Geddes <michael@frog.wheelycreek.net>
Signed-off-by: David Aguilar <davvid@gmail.com>
The unstaging operation no longer calls any of the following:
git update-index --refresh
git diff-index --cached HEAD
git diff-index HEAD
We now simply unstage the file using 'git reset' and then ask
git for the list of all files using 'git ls-files -z'.
We can then classify each unstaged path as being either
modified or untracked based solely on whether or not each
path is a member of the set of known files.
This should noticibly speed things up when working with large
repositories.
Closes#48
Signed-off-by: David Aguilar <davvid@gmail.com>
This shaves a few more git calls from the unstage command
which makes things more pleasant everywhere, and on Windows
in particular.
Closes#48
Signed-off-by: David Aguilar <davvid@gmail.com>
This fixes the performance issues when staging paths.
Fixing the performance of the Unstage command will require a
different strategy. Dulwich and similar libraries are longer-term
things to consider.
Closes#48
Signed-off-by: David Aguilar <davvid@gmail.com>
cola is now certified for Python 2.4 and PyQt 4.1.
Although this combination is fairly old, this allow
us to run on el5, which is still in use in many places.
Some features are disabled when using PyQt < 4.3
but most of the functionality works just fine.
Signed-off-by: David Aguilar <davvid@gmail.com>
Without this patch the InnoSetup compiler errors out and doesn't
create the installer executable.
/q works fine with InnoSetup 5.1.14 but errors out starting
with 5.2.4-dev. Modern versions (e.g. 5.3.8 and 5.3.9)
both error out without this patch.
Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
The tooltip gets in the way of the diff view so let's limit it
to just the status and commit message dock widgets.
Signed-off-by: David Aguilar <davvid@gmail.com>
msysgit sed needs escaped {}s and linux sed barfs when they're escaped.
Avoid the portability issues altogether by using @@ instead.
Thanks to Stefan Naewe for pointing out the issue.
Signed-off-by: David Aguilar <davvid@gmail.com>
There's very few places where we require perl so let's
use the more portable option whenever possible.
We were using perl to do string replacements when
generating conf.py. We can just as easily use 'sed'
and eliminate the pipe while we're at it.
Signed-off-by: David Aguilar <davvid@gmail.com>
Perl always gives the error "Can't do inplace edit on conf.py: Permission denied."
when trying to build any documentation.
This replaces inplace modifications by command piping.
Signed-off-by: Stefan Naewe <stefan.naewe@googlemail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Running difftool on a path that is both modified and staged can be done
from two spots in the repo status tool, the staged version of the path
and the modified version of that path. The difftool run on the staged
version was correctly only showing the staged changes, but run on the
modified section was showing both the staged and modified changes, when
it should really leave out the staged changes.
Signed-off-by: Uri Okrent <uokrent@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
The mistyped signal was preventing stderr from being reported.
Also, use SIGNAL() to shorten long lines.
Signed-off-by: David Aguilar <davvid@gmail.com>
We should probably move all of the infrastructure over to using
run_command(). It's probably better to just use communicate().
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds the command output console as described in git-config(1).
Signed-off-by: Michael Geddes <michaelg@rbionline.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
This sets appropriate defaults for the remote dialogs so that
we can simply click 'fetch', 'push', or 'pull' and it'll do the
normal expected thing, such as:
git fetch origin
git push origin master
git pull origin master
Closes#43
Signed-off-by: David Aguilar <davvid@gmail.com>
This uses a fnmatch pattern to find remote names matching
remote/*. This is a common enough convention that we should
do it by default. If nothing matches we fallback to showing
everything.
Signed-off-by: David Aguilar <davvid@gmail.com>
Widget layout is neatly tucked away in a separate functions.
This let us easily special-case fetch to move the remote to
the top of the GUI.
Signed-off-by: David Aguilar <davvid@gmail.com>
We can't just clone() because we lazily generate the remote
helper functions (fetch, push, pull). The serializer class
handles calling the helper after cloning.
Signed-off-by: David Aguilar <davvid@gmail.com>
Check for the value True so that we don't try to set
text fields using a boolean.
git-config(1) says that the *prompt variables can either
be a boolean or a string to display. This teaches the
action dialog to correctly handle booleans.
Signed-off-by: David Aguilar <davvid@gmail.com>
It's better to make users give us an explicit expression
instead of assuming that 'HEAD' is always a good default.
Signed-off-by: David Aguilar <davvid@gmail.com>
This reads closer to what is going on -- we're prompting the
user. Other signals don't have an interactive component
and thus use the regular notification->command map.
Signed-off-by: David Aguilar <davvid@gmail.com>
This will allow us to run the dialog from the command object
through dependency injection. GUIs register themselves with
the factory through which the commands ask for user input.
This keeps things decoupled yet flexible.
The following commits will integrate this into the main GUI.
Signed-off-by: David Aguilar <davvid@gmail.com>
This dialog is actually a generic "radiobutton +
listwidget driven textbox" but we use it for selecting git refs.
Signed-off-by: David Aguilar <davvid@gmail.com>
This dialog is actually a generic "radiobutton +
listwidget driven textbox" but we use it for selecting git refs.
Signed-off-by: David Aguilar <davvid@gmail.com>
find() lets us search for config names with fnmatch globs.
all() makes it all possible by providing a flattened config
namespace.
Signed-off-by: David Aguilar <davvid@gmail.com>
Prevent dialogs from popping by ensuring they're in the foreground
before showing them. Ya, we probably shouldn't hack show()
to mean show() + raise_(), but it's worked so far...
Signed-off-by: David Aguilar <davvid@gmail.com>
The command factory now allows us to prompt for user inputs.
This is done through a "Command Wrapper" class that is installed
for each parameter that needs user interaction from a command.
This allows the commands to be decoupled from their GUI
components. The dependencies are injected at runtime by
the GUI. Once the wrappers are in place then commands
can prompt for input by going through the command factory.
Signed-off-by: David Aguilar <davvid@gmail.com>
This removes another few hundreds lines of callback code
from the main GUI. We also load less at startup.
controllers/util.py was folded into guicmds as well.
Signed-off-by: David Aguilar <davvid@gmail.com>
Emit logging messages when the GIT_COLA_TRACE environment
variable is defined. This lets users see the various git
commands run by cola during its execution.
$ env GIT_COLA_TRACE=1 git cola
Closes#39
Signed-off-by: David Aguilar <davvid@gmail.com>
Branches and tags are all drawn inside of the same rectangle.
We may want to parse local and remote branches out separately
later so that we can draw separate items for them.
Signed-off-by: David Aguilar <davvid@gmail.com>
This allows us to use the StandardDialog class as the base class
for the GitDAGWidget. A benefit is that the DAG widget is
centered relative to the git-cola window.
Signed-off-by: David Aguilar <davvid@gmail.com>
Since we are now passing the Qt widget parent to the dialog
constructor we can do nice things like center the widget
relative to the git-cola window.
Signed-off-by: David Aguilar <davvid@gmail.com>
Seeing origin/HEAD is probably a little confusing for new users
so filter it out of the decoration list.
Signed-off-by: David Aguilar <davvid@gmail.com>
Launching 'git-cola' from the source tree won't find the html
docs by default so fallback to the asciidoc documentation.
Signed-off-by: David Aguilar <davvid@gmail.com>
* treeview:
dag: Move TODO file to the 'todo' branch
views.dag: Show more edges
git-dag: Show more nodes by default and limit to local branches
views.dag: Add arrows to graph edges
views.dag: Add GitDAGWidget
views.dag: Add horizontal wheel panning
views.dag: Update _zoom when scaling
views.dag: Mouse wheel pans, add control to zoom
views.dag: Zoom more
Added TODO list for treeview branch
views.main: Add 'DAG...' to the tools menu
models.main: Factor out history methods into models.commit
git: Remove the test for None
Remove 'remotes/' and 'heads/' from branch names in dag view
Add sha1 and branch/tag text to the nodes (and give them some space)
Make room for text in the node by providing each with an internal glyph
Set background color the simple way with the background brush
Add additional interesting info to Commits
treeview: add a graphical history viewer
models: add a commits() method for traversing history
This changes the launcher to prefer the user-installed versions
of simplejson and jsonpickle.
We want cola to work with whatever's installed on the system so
doing it this way ensures that we run against the system installed
modules whenever possible.
Signed-off-by: David Aguilar <davvid@gmail.com>
Mention that index.html does not exist until after the install-docs
target has been run. Update the docstrings for consistency while
we're at it.
Signed-off-by: David Aguilar <davvid@gmail.com>
The widget supports shortcut keys such as Ctrl+w.
We might want to split up the GUI to have a details section
which can react to the selection.
Signed-off-by: David Aguilar <davvid@gmail.com>
Moved the ellipse to the side of the node (and only half the width of
the node, and provide a method of addressing the internal ellipse's
center point rather than the center point of the entire node (for use by
the edges).
Signed-off-by: Uri Okrent <uokrent@gmail.com>
This gets rid of the artifacts we were seeing when moving around the
scene. It isn't a fancy gradient, but oh well...
Signed-off-by: Uri Okrent <uokrent@gmail.com>
They now contain the short sha1, the subject, a list of parents, a list
of tags, the author's name, and the author date.
Also added a __repr__ to Commit for sanity's sake
Signed-off-by: Uri Okrent <uokrent@gmail.com>
This adds the cola.views.dag history browser.
This is the beginnings of a nice QGraphicsView
based tree browser.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds a basic commit object and commits() method to
return a commit "objects" for use in history traversal.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds a cola.i18n module for doing gettext translations.
This does away with the qm-based translation system in favor
of a standard gettext setup.
We still monkey-patch QApplication.translate() with our
own custom translator. The main difference is switching
from a Qt-specific QTranslator translation system to a
gettext-based one.
Signed-off-by: David Aguilar <davvid@gmail.com>
Users can actively move or rename files so guard against
this by calling reset() whenever the cache key changes.
The original code calculated the path list once at
startup and did not ever recalculate it. We now recalculate
the list whenever the stat info changes.
A subtle change here is that the old code would always
check $prefix/etc before checking /etc/gitconfig.
git always checks /etc/gitconfig regardless of $prefix
so we can remove that check.
Signed-off-by: David Aguilar <davvid@gmail.com>
There's not much overhead in calling out to git now that
we use a stat cache on .git/HEAD. The Python implementation
is still available as _read_git_head() and is still used
for the 'git init' case.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'qm'-based i18n is currently used but we may be switching
to standard .pot and .mo files soon. This provides the infrastructure
to get this going.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now manage the selection across updates much more carefully.
When items are staged they are selected and their
diff is automatically shown. Vice-versa for unstaged.
A group of selected items retains their selection across
category moves. If an item moves into a new category,
we scroll the viewport to the item in that category.
Priority is given to the current, partially-staged diff
when interactively staging hunks. Otherwise, we would
be breaking context by showing the unstaged diff and then
switching to the staged fragment.
Signed-off-by: David Aguilar <davvid@gmail.com>
Qt knows the size of the tree widget's indentation so use a derived
value instead of hard-coding the x-offset to the icon.
Signed-off-by: David Aguilar <davvid@gmail.com>
Doing this on mouse press was causing an odd interaction with
the selection. Defer until mouse release so that the selection
is applied before this event occurs.
Signed-off-by: David Aguilar <davvid@gmail.com>
Restore the vertical scrollbar's position when model updates occur.
This keeps the viewport from moving around too much.
Signed-off-by: David Aguilar <davvid@gmail.com>
Some users might have $EDITOR configured to 'vim'.
We should redirect these calls to 'gvim' to avoid
creating a zombie editor.
Signed-off-by: David Aguilar <davvid@gmail.com>
Recognize '10.6' as snow_leopard.
Additionally, not knowing the mac platform shouldn't
prevent us from being able to name the tarball.
Signed-off-by: David Aguilar <davvid@gmail.com>
Testing .app bundles is non-trivial on PPC Tiger machines
so mention the testing workaround mentioned on the git-cola
mailing list.
Signed-off-by: David Aguilar <davvid@gmail.com>
Users can specify 'git config color.ui always' in git config
so pass --no-color to override the configuration.
Signed-off-by: David Aguilar <davvid@gmail.com>
QObserver was recently reworked to not override QObject.connect().
When this happened it stopped automatically wrapping signal names
with SIGNAL().
Do the mainstream Qt thing and wrap the signal name with SIGNAL().
Fixes#42
Signed-off-by: David Aguilar <davvid@gmail.com>
The Windows installer suggested
"git-cola : a highly caffeinated git GUI" as the start-menu entry.
This is an invalid folder-name, and the installer subsequently
refuses to use it unless changed.
Fixes#41
Signed-off-by: David Aguilar <davvid@gmail.com>
Review mode used to always find the merge-base with HEAD.
We now search for a tracked branch and then fallback to
'master' if no tracked branch exists.
This is consistent with the common topic-branch workflow.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds menu entries for staging submodule changes and
launching git-cola inside the submodule.
Closes#17
Signed-off-by: David Aguilar <davvid@gmail.com>
We can now stage submodules and launch git-cola on a submodule
from within the submodule diff text context menu.
Signed-off-by: David Aguilar <davvid@gmail.com>
We already imported 'Qt' from 'QtCore' so there's no
need to reference it via 'QtCore.Qt' when we can simply
say 'Qt' instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
setText() guesses the type based on content.
We *always* want plain text, so use setPlainText() instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds a size policy so that QFlowLayoutWidgets are easier
to resize. They are no longer constrained to the size of their
child widgets.
As a consequence, the "Actions" dock can now be resized to be
in its vertical orientation even when space is limited.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds a new box layout widget that changes its orientation when it
is resized. This allows for a more flexible arrangement of the GUI.
Signed-off-by: David Aguilar <davvid@gmail.com>
The fact that difftool honors GIT_DIFF_TOOL is an implementation
detail and should never have been mentioned in the documentation.
Signed-off-by: David Aguilar <davvid@gmail.com>
Import the missing 'shutil' module and fix its misspelling.
Signed-off-by: Iulian Udrea <iulian@ubuntu.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
This simplifies the handling for text fields by removing the
_in_textfield and _in_callback state variables.
In order to avoid loopbacks we simply pass notify=False when
setting the model parameters for text fields in SLOT().
Signed-off-by: David Aguilar <davvid@gmail.com>
This removes the hacky "always wrap connect the signal string in SIGNAL()"
connect() method implemented in QObserver.
Signed-off-by: David Aguilar <davvid@gmail.com>
Fallback to git-update-index instead of git-add when git-reset
exits because we are on a branch that is yet to be born.
Signed-off-by: David Aguilar <davvid@gmail.com>
That's the wrong pattern to use because it prevents us from
using templates in the future. If we start using our own Sphinx
templates later then we can remove .gitignore altogether.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now present a list of bookmarks when run outside of a git
repository so mention it in the release notes.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now unconditionally create bookmark widgets and
hide them when no bookmarks exist.
This also modifies the code to use spaces instead of tabs.
Signed-off-by: David Aguilar <davvid@gmail.com>
This allows the Makefile to pass --standalone to setup.py
when the 'standalone' make variable is supplied.
make standalone=1 install
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes adds a new 'remove unstaged edits'
action and makes the language consistent in the
existing uncommited edits action.
Signed-off-by: David Aguilar <davvid@gmail.com>
This rearranges the table of contents so that things are easier
to find. Notably, the release notes section now has a maxdepth
setting to prevent showing details about each release
on the index page.
Signed-off-by: David Aguilar <davvid@gmail.com>
* commit 'mathstuf/master': (21 commits)
More descriptive name for the menu entry
models.gitrepo: Use NULL to delimit fields instead of slash
views.repo: Add a shortcut for closing the classic widget
qtutils: Add add_close_action()
gitcmds: Remove the _use_patience variable
version: Cache the output of 'git version'
gitcmds: Use cola.version for patience
version: Speed up version checks by using a cache
Make our diffs more patient -- patience is a virtue
qtutils: Do not re-translate strings
cola.app: Guard against QString for PyQt4.3 compatibility
doc: Mention push behavior in the release notes
controllers.remote: Warn when creating a new branch
INSTALL: Update download urls
gitcmds: Fix invalid signature for merge_message()
models.main: Save window settings by default
views.mainwindow: Use a nicer default dock arrangement
views.mainwindow: Use a larger default window size
doc: Do not mention unused cola.geometry variable
doc: Document the 'git cola --classic' option
...
Make --patience the default for diffs produced by cola, if the git
version supports it (that is the user's git client is at least 1.6.2).
Maybe this should be controlled by a configuration somewhere, but I'm
too lazy to make that work now. Also, git config doesn't seem to mention
any existing config for controlling whether or not diff is patience by
default so it doesn't seem like cola should be the thing deciding that.
Is there any downside to always using patience diff?
Signed-off-by: Uri Okrent <uokrent@gmail.com>
Older versions of PyQt4 do not accept QStrings in calls
to QApplication.translate(). Guard against this situation
by wrapping text to translate in str().
Closes#34
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds the missing statusdockwidget and moves things
around so that the diff is on the bottom and the top
has an arrangement of [commit, status, actions].
Signed-off-by: David Aguilar <davvid@gmail.com>
Make --patience the default for diffs produced by cola, if the git
version supports it (that is the user's git client is at least 1.6.2).
Maybe this should be controlled by a configuration somewhere, but I'm
too lazy to make that work now. Also, git config doesn't seem to mention
any existing config for controlling whether or not diff is patience by
default so it doesn't seem like cola should be the thing deciding that.
Is there any downside to always using patience diff?
Signed-off-by: Uri Okrent <uokrent@gmail.com>
Older versions of PyQt4 do not accept QStrings in calls
to QApplication.translate(). Guard against this situation
by wrapping text to translate in str().
Closes#34
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds the missing statusdockwidget and moves things
around so that the diff is on the bottom and the top
has an arrangement of [commit, status, actions].
Signed-off-by: David Aguilar <davvid@gmail.com>
Passing split=True causes all_refs() to return three separate
local_branches, remote_branches, and tags lists.
all_refs() now returns a single concatenated list by default.
Signed-off-by: David Aguilar <davvid@gmail.com>
Certain versions of git are sensitive to the order of options
passed to the git-config command. This ensures that --list
is passed last.
Signed-off-by: David Aguilar <davvid@gmail.com>
current_branch() used a stat cache which was not very reliable.
We now use the raw content of .git/HEAD as the cache key.
This is simpler and more robust than a stat() cache.
Signed-off-by: David Aguilar <davvid@gmail.com>
The stat cache is probably not very portable and doesn't lend
itself well to testing so bail on it. We now use the raw
content of each config file as its cache key.
Signed-off-by: David Aguilar <davvid@gmail.com>
This removes the classic dock widget. There's a few reasons
why it's nice to have the classic view in its own window.
Signed-off-by: David Aguilar <davvid@gmail.com>
This is a trivial style cleanup to make the command module
consistent in how it accesses the model object.
Signed-off-by: David Aguilar <davvid@gmail.com>
This modifies default_remote() to use the static GitConfig instance.
The old version did not always return the right value so this also
adds a test case to ensure correctness.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-cola originally support PyQt 4.3.x.
We lost compatibility with the recent UI rework.
This makes git-cola work on PyQt 4.3.x again by simply
avoiding some of the newer feature.
Signed-off-by: David Aguilar <davvid@gmail.com>
The test helper module is now simpler. We no longer import
join, dirname and basename directly. Several global variables
were removed.
Signed-off-by: David Aguilar <davvid@gmail.com>
This modifies the CompareModel and BranchCompareModel classes
to not derive from the main model. They now derive from
observable model instead. The update_revision_lists() method
is now part of the CompareModel where it is more appropriate.
Signed-off-by: David Aguilar <davvid@gmail.com>
This factors out the data used by the repobrowser.
This should allow us to slim down the main model even further.
Signed-off-by: David Aguilar <davvid@gmail.com>
If we had diffed a staged file then cola wouldn't allow the amend
checkbox to take effect. This was fixed by restricting the cases
where the Diff command is allowed to change modes.
Signed-off-by: David Aguilar <davvid@gmail.com>
This finally brings the main model down to a manageable size.
The next step is to break out the browser data which is used
by the repobrowser only.
Signed-off-by: David Aguilar <davvid@gmail.com>
branch_list() no longer lives within the model.
This version also uses git-for-each-ref, which is preferred over
screen-scraping git-branch.
Signed-off-by: David Aguilar <davvid@gmail.com>
This factors current_branch() out of the main model.
This version is faster than the original in that it no longer
calls out to git. Instead, we read .git/HEAD directly and
cache the result behind a stat() cache.
Signed-off-by: David Aguilar <davvid@gmail.com>
An open dialog was originally used when cola was run outside of
a git repository. We now allow cloning a repository as well.
Closes#22
Signed-off-by: David Aguilar <davvid@gmail.com>
We should give the option of either opening or cloning a repo
when cola is run outside of a git repo. The StartupDialog
provides the GUI interaction for doing so.
Signed-off-by: David Aguilar <davvid@gmail.com>
We want to be able to initiate a cola session with a clone so
add the ability to clone without spawning a new session.
Signed-off-by: David Aguilar <davvid@gmail.com>
* maint-1.4.0:
doc: Add git-cola-1.4.0.5 release notes
doc: Consolidate release notes onto a single page
cola.commands: Update status tree when amending commits
views.main: Ensure that the 'amend' checkbox gets unchecked
cola.utils: Properly launch external apps on win32
Conflicts:
share/doc/git-cola/relnotes/releases.rst
Signed-off-by: David Aguilar <davvid@gmail.com>
The status tree was not getting updated when commits were
amended. This was because the Commit command was not resetting
the model's 'head' attribute.
We now derive Commit from ResetMode so that this and other
duplicate actions are handled.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'amend' checkbox was not always unchecking itself when
mode were switched by clicking on the empty area in the status
tree. We now handle this condition correctly.
Signed-off-by: David Aguilar <davvid@gmail.com>
Windows requires an amazing number of hacks to do something
as simple as running a command in the background.
Signed-off-by: David Aguilar <davvid@gmail.com>
Expanding childless top-level items causes X11 warnings to appear
in the shell. This was happening because we were looping over
each top-level item inside of expand_items().
expand_items() now expands the item passed into it only.
Signed-off-by: David Aguilar <davvid@gmail.com>
There were several places where we were using the phrase 'git gui'
instead of 'Git GUI'. The latter is preferred.
Signed-off-by: David Aguilar <davvid@gmail.com>
The cola.fontdiff setting can contain non-integer
font sizes, so guard against it by casting to a float
before casting to int.
Closes#32
Signed-off-by: David Aguilar <davvid@gmail.com>
It is now possible to apply patches by dropping them onto cola.
cola also allows you to drop directories in which case cola
walks the directory structure gathering a list of patches, sorts
them alphanumerically, and applies them in order.
Closes#3
Signed-off-by: David Aguilar <davvid@gmail.com>
The signal names are plain strings now and thus there's no
reason to pass them through QtCore.SIGNAL(). This simplifies
the signals module by making it contain nothing more than a
collection of constants.
Signed-off-by: David Aguilar <davvid@gmail.com>
We used to remove 'build', 'dist', and builtin_version.py in the
build targets. We no longer do any cleaning in the build
targets and handle all cleanup tasks in the 'clean' target only.
Signed-off-by: David Aguilar <davvid@gmail.com>
We no longer remote builtin_version in setup.py.
This allows us to find builtin_version when running cola from
its source tree. We also break out of the loop when
builtin_version is found which makes cola return the correct
version number instead of always falling back to 'git describe'.
Signed-off-by: David Aguilar <davvid@gmail.com>
'git ls-files --all --others' can return files in an unsorted order,
namely untracked files can come before tracked files.
Return a sorted list in everything() to make it more intuitive.
Signed-off-by: David Aguilar <davvid@gmail.com>
We forgot to pass --exclude-standard to git-ls-files.
An untracked_files() method was added and update_status() was
updated to use it.
Closes#26
Signed-off-by: David Aguilar <davvid@gmail.com>
We don't need to call strip() if we can omit the last character.
We don't need to sort files since users might expect git's
ignore-dot-files order.
Signed-off-by: David Aguilar <davvid@gmail.com>
There's some discussions on the git ML about changing
git-describe so that it automatically appends -dirty.
This future proofs us in case this patch goes through.
Signed-off-by: David Aguilar <davvid@gmail.com>
The build system always removed builtin_version.py.
When distributing tarballs, though, we don't have .git
and thus can't generate this file during the build.
This changes things so that the builtin_version.py
module is only generated and deleted when inside
of a git repository.
Signed-off-by: David Aguilar <davvid@gmail.com>
cola locks up when remote operations are attempted
on SSH URLs that require a password and no TTY is
available.
To fix this we now provide our own SSH_ASKPASS
implementation as a fallback.
Closes#23
Signed-off-by: David Aguilar <davvid@gmail.com>
PyQt4 segfaults when children are added to QStandardItemModels
after a view is observing it.
This works on older version of PyQt4 so this is a workaround
until we have a better solution.
The downside of this change is that we won't recognize when
new files appear in the repository. The upside is that it
avoids PyQt4 segfaults.
Closes#25
Signed-off-by: David Aguilar <david.aguilar@disneyanimation.com>
model.everything() used to use its cached values for staged,
unstaged, etc. It's better to simply re-run git ls-files instead.
Signed-off-by: David Aguilar <david.aguilar@disneyanimation.com>
We no longer need to register message names. This takes away the
runtime check for valid message names, but in practice we won't
ever use a bad name since we're already using the class constant.
Thus, the runtime check is useless.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now give GitRepoInfoEvents a custom type() so that we can
tell them apart from builtin Qt events.
Closes#25
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'Actions/Create Tag...' menu now launches a dialog for
creating tags. We assume that users have a gpg-agent setup
when using signed tags. If that is not the case then
git will read the GPG password from stdin.
Closes#11
Signed-off-by: David Aguilar <davvid@gmail.com>
We can do less in each function since nothing is observing the
paths_staged/unstaged/reverted messages anymore.
stage_paths() now benefits from only ever running at most 2 git commands
to update the index - add for additions and add -u for removals.
Signed-off-by: David Aguilar <davvid@gmail.com>
Qt signals+slots are limiting because they don't allow optional
keyword arguments. Let's write our own so we can simplify the
Diff command later.
Signed-off-by: David Aguilar <davvid@gmail.com>
This uses threading.Lock to serialize access to the git binary.
Git calls fail when another git process is running due to the
.git/index.lock file. By serializing git calls we guard against
threads triggering this condition.
Signed-off-by: David Aguilar <davvid@gmail.com>
We used to avoid using Qt's data so that we'd always index into
the model directly. It's simpler to use it though, and also handles
the editable combobox case.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were setting the background color but weren't setting the
foreground color. This makes the column indicator look bad when
a dark theme with a light font is used.
Signed-off-by: David Aguilar <davvid@gmail.com>
Selection is now handled by a static SelectionModel instance.
This allows individual tools to modify the selection and have
the selection reflected in the corresponding menus and actions.
Closes#19
Signed-off-by: David Aguilar <davvid@gmail.com>
This is preparation for the next series of commits which will
move information about which filenames have been selected into
a standalone selection model.
Signed-off-by: David Aguilar <davvid@gmail.com>
These values are used to calculate branches that are changed upstream
so set them before gathering that information.
Signed-off-by: David Aguilar <davvid@gmail.com>
The model used to emit special signals that the classic view watched.
The GitRepoModel now observes the main cola model and keeps track of
of its own state. This will allow us to eliminate the specialized
signals which are currently used by the classic view only.
Signed-off-by: David Aguilar <davvid@gmail.com>
AmendMode knows how to recall the previous commit message by inspecting
the undo/redo stack. This re-enables the stacks to enable this feature.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were carrying around references to GitRepoEntry instances
when we could have looked them up in the GitRepoEntryManager.
This removes the redundant references to minimize memory usage.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now use non-Qt signatures in the signals used for thread communication.
The signal defines were made into upper case variable names to better
signify that they are constants.
Signed-off-by: David Aguilar <davvid@gmail.com>
The inotify threads are now started outside of the controllers in
main(). This will enable the standalone classic view to take
advantage of inotify.
Signed-off-by: David Aguilar <davvid@gmail.com>
The qtutils dependency broke the build because we were
requiring UI components in core. The UI listener now
registers itself at runtime.
Signed-off-by: David Aguilar <davvid@gmail.com>
It says 'Stage' now, though, and stages everything if there's
nothing selected. Otherwise, it stages the selection.
Signed-off-by: David Aguilar <davvid@gmail.com>
Re-run the diff when processing diff selections so that we
get immediate feedback about the effect of the command.
Signed-off-by: David Aguilar <davvid@gmail.com>
The file names are lists, not single values.
The command object expects lists, so pass them through as-is.
Signed-off-by: David Aguilar <davvid@gmail.com>
Log is now implemented in terms of notification.
This means that logging can be handled independently of the GUI.
Signed-off-by: David Aguilar <davvid@gmail.com>
Qt might not have an active window and thus widget.parent()
returns None. We now gracefully handle this scenario.
Signed-off-by: David Aguilar <davvid@gmail.com>
This moves the repo browser callbacks into the main view,
further minimizing the role of the main controller.
Signed-off-by: David Aguilar <davvid@gmail.com>
This changes the imports so that we only import QtGui and use the
classes contained within instead of importing QDialog and QMenu
directly.
Signed-off-by: David Aguilar <davvid@gmail.com>
The old code would silently call update_status() so that its view
of the world was up-to-date before issuing git commands.
The tests check for this behavior, so reinstate the original
behavior from the classic model.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now default to using the static model instance so there's no
need for callers to supply the model. Additionally, instead of
passing in the view we use Qt's active window.
Signed-off-by: David Aguilar <davvid@gmail.com>
This libifies many of the operations cola was performing
in the main controller. We'll keep gutting controllers
until we have commands for everything.
Signed-off-by: David Aguilar <davvid@gmail.com>
The main controller is starting to get twisted apart.
This removes a good portion of the duties the controller
was performing.
Signed-off-by: David Aguilar <davvid@gmail.com>
The philosophy is that views should broadcast signals for
the command factory to interpret. This moves all of the
user interaction code in the view module where it belongs.
The corresponding commands are in subsequent commits.
Signed-off-by: David Aguilar <davvid@gmail.com>
Bootstrapping happens outside of the Qt event loop
since that'll be removed from the main controller in the
next series of commits.
Signed-off-by: David Aguilar <davvid@gmail.com>
The cmdfactory converts model notifications into messages
that are picked up by the Qt observers. This adds more
messages to its notification list.
Signed-off-by: David Aguilar <davvid@gmail.com>
checksum() returns an md5 hash for use on commit messages.
quote_repopath() works around shell behavior on win32.
Signed-off-by: David Aguilar <davvid@gmail.com>
This fixes a problem where the layout wasn't showing the entire
contents of the "exit <mode> mode" button.
Signed-off-by: David Aguilar <davvid@gmail.com>
This moves the signoff and commit buttons into the commit message
editor dock. This streamlines the UI so that all commit message
controls are in the same visual space.
Signed-off-by: David Aguilar <davvid@gmail.com>
This moves the text-position display out of the actions button dock
and into the commit message editor. The display also gives warnings
when lines are too long; yellow, orange and red backgrounds are used
at the 64, 72, and 78 character-wide boundaries.
Signed-off-by: David Aguilar <davvid@gmail.com>
If callers do not pass in any values when SLOT is called then we
relay the values passed in by the callback invoker. When values
are provided then we prefer those values over the ones available
when the callback is invoked.
This makes it so that values provided at registration-time
override run-time values from the signal.
Signed-off-by: David Aguilar <davvid@gmail.com>
UI interaction is directly handled by the view and
model state management is handled by the command object
so don't do anything in the controller.
Signed-off-by: David Aguilar <davvid@gmail.com>
This removes the command registration from the factory.
Registration is now done by the cola.commands module in main().
Signed-off-by: David Aguilar <davvid@gmail.com>
The main display now updates itself via the messaging interface.
This allows any object to update it by issuing text signals over
the notifier.
Signed-off-by: David Aguilar <davvid@gmail.com>
This opens each category list when items are added.
We only expand the category folder once so that users
can choose to keep a category closed.
Signed-off-by: David Aguilar <davvid@gmail.com>
This changes QFontCombobox to match the newer Qt API.
Instead of modifying the in-place currentfont we now create a
new QFont instance and vivify it from the model's value.
Signed-off-by: David Aguilar <davvid@gmail.com>
create_treewidget_item and cached_icon shared the same dictionary for caching,
so make create_treewidget_item use its own cache.
Signed-off-by: David Aguilar <davvid@gmail.com>
We no longer support the cola.fontui configuration setting.
cola will always inherit the system default font which
simplfiies things for users and makes cola integrate
better style-wise with other applications.
Signed-off-by: David Aguilar <davvid@gmail.com>
It was previously the caller's responsiblity to translate the
strings used by 'prompt', 'question', and 'information'.
This moves the translation calls into the functions and thus
removes the burden from the callers.
Signed-off-by: David Aguilar <davvid@gmail.com>
This renames the 'input' variable used in 'shell_quote' to avoid
using the same name as the Python builtin.
Signed-off-by: David Aguilar <davvid@gmail.com>
This commit renames 'sanitize_input' to 'sanitize' and removes
any changes the function to avoid the using variables named
'input'.
Signed-off-by: David Aguilar <davvid@gmail.com>
cola.model previously provided closures over attributes for calling
getattr(self, 'x') as self.get_x(). This is unused so remove it.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes sure that the 'unstaged' attribute is properly
initialized. Not doing so can make the unstaged list empty,
thus resulting in status tree events that do nothing.
Signed-off-by: David Aguilar <davvid@gmail.com>
We shouldn't check for renames if upstream changed because
we don't handle it and things are simpler if we treat renames
as a simple add and deletion.
Signed-off-by: David Aguilar <davvid@gmail.com>
Instead of trying to parse the rename information,
simply ignore renames and treat them like an add and
remove, which is exactly what the GUI wants to display
anyways.
Signed-off-by: David Aguilar <davvid@gmail.com>
In the classic view, when the current branch is tracking a remote
branch, detect when there are changes to paths on the tracked branch.
The 'Changed Upstream' status is lower priority than local changes
(e.g., if a file is changed upstream, but is also locally modified,
the classic view will show it as locally modified, but not changed
upstream, since that is probably just confusing and there is limited
space in the status area).
A corresponding new action to 'checkout updated file' should be added
to the list of actions for paths, and enabled when the path is
'changed upstream'.
Signed-off-by: Uri Okrent <uokrent@gmail.com>
This modifies the show() method to position new dialogs lower
on the screen such that their parent's titlebar are no longer
obscured.
Signed-off-by: David Aguilar <davvid@gmail.com>
This replaces the .ui-based MergeView with the new one provided
by cola.views.merge. This also moves some code from the
controller into the view where it rightfully belongs.
Signed-off-by: David Aguilar <davvid@gmail.com>
The top-level Makefile now delegates to the test/Makefile when
running tests. This removes the repeated nosetests commands
in both Makefile and test/Makefile.
Signed-off-by: David Aguilar <davvid@gmail.com>
The cola UI is now based upon dock widgets and is thus much
more flexible. Individual interface elements can now be
rearranged and configured at runtime.
Signed-off-by: David Aguilar <davvid@gmail.com>
This removes all references to the old logger and adds the
bootstrap method to qtutils for creating the log widget.
Signed-off-by: David Aguilar <davvid@gmail.com>
This exposes a new create_standard_widget function which is used
as a building block for create_standard_view. This allows us to
decorate simple Qt widgets with style and preference methods.
Signed-off-by: David Aguilar <davvid@gmail.com>
QObserver previously required that all widgets provide a unique
object name. QObserver can now work with nameless or arbitrarily
named widgets. This decouples the controller from the view and
also makes it simpler to write new views.
Signed-off-by: David Aguilar <davvid@gmail.com>
The ordered_dict popitems() method was using a syntax that was not
understood by Python2.4, so use a backwards-compatible syntax.
Signed-off-by: David Aguilar <davvid@gmail.com>
The header columns are now:
Name, Status, Age, Message, Who
'Name' is the file path.
'Status' is the paths' status.
'Age' is the time since the latest commit.
'Message' is the subject of the latest commit.
'Who' is the author of the latest commit touching the path.
Signed-off-by: David Aguilar <davvid@gmail.com>
Launching the 'select commits' dialog and processing the results is
a task for the controller, not the view.
Signed-off-by: David Aguilar <davvid@gmail.com>
Instead of calling self.model().app_model we now store a reference
in setModel() and use it throughout the RepoTreeView.
Signed-off-by: David Aguilar <davvid@gmail.com>
Git users are power users, so support vim keybindings.
We might want to be able to configure this in the future.
Signed-off-by: David Aguilar <davvid@gmail.com>
selected_tracked_paths() was not considering unmodified entries as
tracked. It now looks uses information from tracked, staged,
and modified entries when deciding if a path is 'tracked'.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds the MVC hooks to views/repo and controllers/classic to
enable reverting paths back to their committed state.
Signed-off-by: David Aguilar <davvid@gmail.com>
'revert_paths' removes local changes by reverting file paths back to
their content in the latest commit.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'View Diff...' action now accepts multiple paths.
We can now select a directory or multi-select individual items
in the treeview when launching difftool.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds a register_messages() method to Observable for handling
message registration. Unknown messages raise ValueError when
observers attempt to connect to them.
Signed-off-by: David Aguilar <davvid@gmail.com>
We should not enable difftool for untracked paths. This changes the
update_actions() logic to disable difftool when the current path is
an untracked file.
A new helper 'selected_modified_paths()' method was added so that
we can detect whether a path is modified.
Signed-off-by: David Aguilar <davvid@gmail.com>
When Key_Left is pressed we should automatically move the cursor
to the parent directory when the cursor is either on a file
entry or a collapsed directory.
Signed-off-by: David Aguilar <davvid@gmail.com>
We weren't properly detecting newly-staged files that came in as
a result of staging a subdirectory. Detect this condition and
add a testcase.
Signed-off-by: David Aguilar <davvid@gmail.com>
stage_paths() is now more resilient to changes done behind
its back. This updates the test to reflect the simpler API.
Signed-off-by: David Aguilar <davvid@gmail.com>
GitRepoModel now knows about untracked entries.
'Last Modified' information is gathered by querying the filesystem.
Signed-off-by: David Aguilar <davvid@gmail.com>
'everything' returns the combined output of 'git ls-files' and
'git ls-files --others --exclude-standard' in a sorted list.
Signed-off-by: David Aguilar <davvid@gmail.com>
The controller no longer modifies the view directly.
Instead, the view registers for the 'paths_staged' message
from the model and reacts accordingly.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes things easier to read by adding an entry() method and
using it in add_file() / add_directory().
Signed-off-by: David Aguilar <davvid@gmail.com>
We now use insertRow() / appendRow() when adding rows to
GitRepoItems. This fixes a bug where directories were overwriting
existing file entries.
This introduces a _create_row() method to handle creating a
GitRepoItem for each 'Status', 'Modified', etc. cell.
Signed-off-by: David Aguilar <davvid@gmail.com>
'message observers' allow observers to attach methods onto model
notification events. Instead of a following a specific interface,
observers are free to provide any Python method as an 'observer'
which is invoked whenever notification occurs.
Signed-off-by: David Aguilar <davvid@gmail.com>
ObservableModel's unserializable data is now encapsulated into a single
dictionary that is updated whenever the new unserializable data is
introduced.
Signed-off-by: David Aguilar <davvid@gmail.com>
Using static status data will make it harder to perform tasks such as
'stage selected', etc. from the repo view, so make all status data
ephemeral.
Signed-off-by: David Aguilar <davvid@gmail.com>
The standalone repo view should wait for all threads to finish before
exiting the application. Failure to do so causes Python to explode.
Signed-off-by: David Aguilar <davvid@gmail.com>
The carat character is itself a reserved shell character.
Thus, to type a carat character as part of a command argument,
type two carats instead.
http://technet.microsoft.com/en-us/library/cc723564.aspx
This was breaking both diff-mode and the amend-commit
functionality.
Closes#13
Signed-off-by: David Aguilar <davvid@gmail.com>
Reported-by: Jorge <boxerab@gmail.com>
When using fork() on win32 we should check for the existence of a
filename with and without the '.exe' extension.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now traverse parent directories and mark them with status information
corresponding to their child entries.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds a utils.dirname() implementation for cross-platform use.
We don't use os.path.{dir,base}name since git always uses
'/' regardless of platform.
This also adds a testcases for dirname and basename.
Signed-off-by: David Aguilar <davvid@gmail.com>
We used to spawn a new thread for every column in the tree view.
We only need to spawn one, actually, since all of the columns
re-use the same entry and thus calling update() three times is
wasteful.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were previously creating new threads for every single path in
the repo at once. We now spawn threads as new directories are
exposed.
Signed-off-by: David Aguilar <davvid@gmail.com>
It is completely conceivable that a path was only ever been touched by a
merge so we shouldn't use --no-merges when looking up data about that
path.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now use a QThreadPool to update information about items
in the repo view. Status information is gathered in the
background so that the GUI can load more quickly.
Signed-off-by: David Aguilar <davvid@gmail.com>
Using QStandardItems allows us to simplify things since they handle
much more vs. the QAbstractItems we were using previously.
Signed-off-by: David Aguilar <davvid@gmail.com>
This introduces a convenient enter/exit_diff_mode() method on the
main view and teaches the main controller to use it when appropriate.
Signed-off-by: David Aguilar <davvid@gmail.com>
We did not properly handle 'HEAD^ HEAD' because of the embedded space.
We now properly handle this by splitting arguments before passing
them along to git.
Signed-off-by: David Aguilar <davvid@gmail.com>
We no longer rely on heuristics when deciding how to construct
arguments intended for git diff. The controller knows what mode
it's in and thus never rely on heuristics.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were incorrectly passing --cached in some instances when using
`diff-by-expression` or `diff-mode`. This fixes things so
that we are more robust to free-form input.
Signed-off-by: David Aguilar <davvid@gmail.com>
We used to use ...branchname when showing the diff for review mode.
We now use `$(git merge-base HEAD branchname)..branchname` since it
is more robust.
Signed-off-by: David Aguilar <davvid@gmail.com>
The (currently empty) controller knew too much about the model's
internals, so refactor that knowledge it into the model itself.
Signed-off-by: David Aguilar <davvid@gmail.com>
Users have often asked to see the status of their entire project.
The 'classic' controller provides this behavior.
Signed-off-by: David Aguilar <davvid@gmail.com>
all_files() is a helper method around 'git ls-files -z' that returns
a list of all files in a repository.
Signed-off-by: David Aguilar <davvid@gmail.com>
Older versions of pyuic4 were implemented as a shell script instead
of as python script. Interestingly, an older version existed
that didn't have a '#!/bin/sh' shebang line.
Use 'sh -c' to accomodate both current and older, buggy pyuic4s.
Signed-off-by: David Aguilar <davvid@gmail.com>
We weren't reacting to the selectionChanged() callback and thus
were not displaying diffs when changing the selection using the
arrow keys.
Signed-off-by: David Aguilar <davvid@gmail.com>
Diff -> Expression... allows you to enter a diff expression
such as master~3...master and see the results in the
Repository Status tree.
Signed-off-by: David Aguilar <davvid@gmail.com>
Diff against SHA-1, diff branches, and diff commits should
all be in the same menu. The "diff expression" action
can then go in this menu.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'staged' parameter was never used, so remove it.
This also means we can use the callback directly without
having to wrap it with a lambda.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-cola would hang on Ubuntu systems when pyinotify was installed.
This fixes it by adding a setter for the GitNotifier.
Signed-off-by: Uri Okrent <uokrent@gmail.com>
We used to check every modified item to see if it was partially staged.
It's fast to only check the staged items.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were previously guarding users against accidentally clicking on an
unmerged entry to stage it. This was confusing
Signed-off-by: David Aguilar <davvid@gmail.com>
The models, views and controllers packages were doing too much in module __init__.
This simplifies things by doing nothing in __init__ and using the fully-qualified
package in the callers.
This adds a cola.models package that didn't exist before.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds the ability to save the splitter sizes on startup/shutdown
by removing responsibility from the models. We now use a SettingManager
singleton to provide an api for arbitrary data saving.
Signed-off-by: David Aguilar <davvid@gmail.com>
The SettingsManager class provides an interface for view
de/serialization. We'll use this to handle saving gui settings.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds export_state() and import_state() methods to the
StandardView class. Subclasses extend this method to
handle custom view data.
Signed-off-by: David Aguilar <davvid@gmail.com>
cola.model.Model no longer derives from Observable.
Instead, classes that need subject/observer behavior use
the observable.Observable mixin.
Signed-off-by: David Aguilar <davvid@gmail.com>
Branch->Review compares a branch against its common ancestor
with the current branch. This basically shows you what's
in a branch and lets you run difftool on it.
Signed-off-by: David Aguilar <davvid@gmail.com>
'git push' now requires both the remote and branch to be specified when pushing,
so select the current branch by default since that is the typical use case.
Signed-off-by: David Aguilar <davvid@gmail.com>
Debian bug #519972 suggested installing all items into
/usr/share/git-cola/* instead of /usr/share/cola.
Signed-off-by: David Aguilar <davvid@gmail.com>
We keep git-difftool around for compatibility purposes only.
This pulls in vimdiff fixes and support for diffuse.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes things clearer by using a list as an argument
to utils.fork(). This also centralizes the difftool invocations
in the cola.difftool module.
Signed-off-by: David Aguilar <davvid@gmail.com>
This fixes debian bug #519972:
git-cola: should use private module dirs.
All of the cola modules are now installed into $prefix/share/cola/lib.
The private versions of jsonpickle and simplejson were moved up
a level in the source tree and synced with upstream since they are now
installed into $prefix/share/cola/lib as well.
Signed-off-by: David Aguilar <davvid@gmail.com>
ColaApplication no longer inherits from QApplication. It now
contains either a QApplication or QCoreApplication based on the value
of the gui=<bool> construction option.
Consequently, this makes tests work without a gui =)
Signed-off-by: David Aguilar <davvid@gmail.com>
ColaError is now the base of all cola exceptions.
We don't really use exceptions much at the moment, but it's there
for future use.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds tests to ensure that the git.Git command object
never deadlocks and properly handles interrupted system calls.
This also does away with the stdout/stderr.py fixtures
since the code is now contained within each test.
Signed-off-by: David Aguilar <davvid@gmail.com>
difftool now supports difftool.prompt so that users do not have to
pass --no-prompt or hit enter each time a diff tool is launched.
The --prompt flag overrides the configuration variable.
Signed-off-by: David Aguilar <davvid@gmail.com>
I don't even know what $COMSPEC means so let's be safe and use the
same perly $^O test add--interactive uses. While we're at it, make
git-difftool match the prevalent git-perl style.
Signed-off-by: David Aguilar <davvid@gmail.com>
test_cola_model now uses its own local model for testing
so that we don't have to maintain one in the test/helper module.
Signed-off-by: David Aguilar <davvid@gmail.com>
cola.git's execute() method now uses {read,wait}_nointr() to handle the
"interrupted system call" problem.
Signed-off-by: David Aguilar <davvid@gmail.com>
OSX and other systems can interrupt us in the middle of a system call so
wrap all read/write calls with an automatic retry loop.
Signed-off-by: David Aguilar <davvid@gmail.com>
This refactors things so that ColaApplication lives in the cola.app module.
i18n is tested by the test_cola_app test script.
Signed-off-by: David Aguilar <davvid@gmail.com>
The test target no longer adds build/lib to PYTHONPATH.
The 'coverage' target runs nose's coverage plugin.
Signed-off-by: David Aguilar <davvid@gmail.com>
We're going to hide local branches in the pull dialog (so that pulling
can only happen on the current branch) so prepare the model for the new
caller. This improves the usability of fetch/push as well.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes things the interface simpler by removing the rarely-used
search feature in the cola log gui.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes it so that the log window honors cola.showoutput.
never = never show output
always = always show the output
errors = only show output on errors (default)
This was done by centralizing logging logic in qtutils.log() and adding
a model.should_display_log(status) method.
Signed-off-by: David Aguilar <davvid@gmail.com>
The status bar isn't very useful now that the right-hand tree widget
succinctly displays a file's status, so remove it.
Signed-off-by: David Aguilar <davvid@gmail.com>
The log window is now a drawer positioned at the bottom of the
main window. This does away with the dreaded log window.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes the util controller more lightweight separating out the
logger, options, and select_commits functionality into separate
controllers.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now access QtGui classes through the QtGui module so that
we import less and are more explicit about our module
dependencies at the call sites.
Signed-off-by: David Aguilar <davvid@gmail.com>
This changes call sites so that they always use core.encode/decode
instead of importing those functions directly.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now use get_param() so that we can pass default values to
the get_global_config(). load_commitmsg_template() was updated
accordingly.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now return the empty string when our head is detached in
current_branch(). This also improves detached head usability
by capturing the stderr message that was being printed to the
console at startup.
Signed-off-by: David Aguilar <davvid@gmail.com>
We should probably keep LOCAL/REMOTE since that's consistent with
the rest of git. This also adds fallbacks for the old mergetool
variables for user convenience.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds a keep_index checkbox to the stash dialog so that
users can save stashes and and keep the index state.
Signed-off-by: David Aguilar <davvid@gmail.com>
Now that difftool uses diff.tool instead of merge.tool
we teach cola to use merge.tool.
This also removes all usage of the --tool=<tool> parameter
to git-mergetool and git-difftool since the assumption is
that users will use the appropriate diff/merge.tool config variable.
Signed-off-by: David Aguilar <davvid@gmail.com>
Users might want to have different settings for merging and
diffing, so difftool should use its own config variables
for setting defaults. We now use the difftool.* config names
instead of mergetool.*.
We still fallback to merge.tool to make it easier on users
who haven't yet defined the new diff.tool config variable.
Signed-off-by: David Aguilar <davvid@gmail.com>
This teaches cola to detect the case where an untracked file is added
and then modified prior to commit.
cola now displays the path as both staged and modified, which matches
git status.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes things "more pythonic" by removing the create()
method. We let jsonpickle handle serialization stuff so that
the model has to know less about how to translate python
objects into dictionaries.
The next thing to do is factor out the common git properties
and subclass models.Model for different controllers:
models.search, models.compare, etc.
Signed-off-by: David Aguilar <davvid@gmail.com>
This removes the init() methods in the view internals and makes
things look a bit more pythonic style-wise.
Signed-off-by: David Aguilar <davvid@gmail.com>
We probably only need to be bigger than PAGE_SIZE so to catch
deadlock so set our buffers to PAGE_SIZE * 2
Signed-off-by: David Aguilar <davvid@gmail.com>
PEP-8 recommends using absolute imports to improve portability with
older versions of Python. Relative imports can also be ambiguous
so don't use them.
Signed-off-by: David Aguilar <davvid@gmail.com>
We used to select blindly select the first remote.
We now default to 'origin' if it exists and fallback to the
first remote otherwise.
Signed-off-by: David Aguilar <davvid@gmail.com>
The local repository options had text fields that were too small because
the diff context field wasn't using a colspan.
Signed-off-by: David Aguilar <davvid@gmail.com>
git difftool listed some candidates for mergetools twice, depending on
the environment.
This slightly changes the behavior when both KDE_FULL_SESSION and
GNOME_DESKTOP_SESSION_ID are set at the same time; in such a case
meld is used in favor of kdiff3 (the old code favored kdiff3 in such a
case), but it should not matter in practice.
Signed-off-by: David Aguilar <davvid@gmail.com>
We'll be doing some big changes soon, so get everything out of __init__
because we really shouldn't be doing much in there at all.
Signed-off-by: David Aguilar <davvid@gmail.com>
Without this we get vuknown-version when running cola out of its source tree.
Reported-by: Mechazawa <zedside@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
We can now create binary installers for Windows.
create-installer.sh drives InnoSetup and generates Cola-$VERSION.exe.
Signed-off-by: David Aguilar <davvid@gmail.com>
Launching cola from Windows ends up with an environment where 'git.exe'
is not in the $PATH. The Windows installer will supply --git-path
which solves this issue.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'dirname' function did not properly handle paths with
embedded spaces. Also, Windows uses git-cola.pyw instead
of the default git-cola startup script.
Signed-off-by: David Aguilar <davvid@gmail.com>
Windows uses a slightly modified installation layout that does
not include the 'python2.x' directory in its site-packages path.
Signed-off-by: David Aguilar <davvid@gmail.com>
difftool is now available in cola.git and git.git.
Mention this and recommend usage of the version from git.git.
Signed-off-by: David Aguilar <davvid@gmail.com>
Markus Heidelberg provided this patch against git.git's
contrib/difftool.
In 'man 1p trap' there is written:
"The condition can be EXIT, 0 (equivalent to EXIT), or a signal
specified using a symbolic name, without the SIG prefix, [...]"
"Implementations may permit names with the SIG prefix or ignore case
in signal names as an extension."
So now we do it the POSIX compliant way instead of using an extension.
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: David Aguilar <davvid@gmail.com>
Markus Heidelberg has a number of stylistic improvements to the
difftool documentation and comments. This also adds usage of the
vim "wincmd" command for positioning the cursor at startup.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now grab stderr only when we really need to do so.
Places that care about stderr but not about the return status
no longer need to grab it into a throw-away variable.
Signed-off-by: David Aguilar <davvid@gmail.com>
The git command module will only include stderr when the with_stderr
option is set to True. This separates with_extended_output and with_stderr
so that they do not have overlapping duties.
Signed-off-by: David Aguilar <davvid@gmail.com>
We no longer post-process the status data to remove unmerged
items from the modified files list -- this is done up front
when unmerged entries are first found.
Signed-off-by: David Aguilar <davvid@gmail.com>
The stderr+stdout handling in the git module was broken because it
could deadlock on older versions of Python. All of the complication
came from trying to handle both stderr and stdout in the same
function. We now pass stderr=subprocess.STDOUT to subprocess.Popen
so that things become much simpler. We only include stderr when
with_extended_output=True, otherwise we ignore it.
This fixes deadlocks on older Pythons and on Mac OSX.
It also seems to speed things up a bit on Linux, which is a plus.
Signed-off-by: David Aguilar <davvid@gmail.com>
The pyinotify API changed between 0.7.x and 0.8.x.
The cola.inotify module now works with both 0.8.x and as 0.7.x.
We do accomplish this by checking pyinotify.__version__ at runtime
to determine which API to use.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-difftool now works on Windows.
The GIT_EXTERNAL_DIFF rewrite broke Windows.
This makes things happy again.
Signed-off-by: David Aguilar <davvid@gmail.com>
Users can now specify their own tab width in the options dialog.
The setting corresponds to the cola.tabwidth git configuration variable.
Signed-off-by: David Aguilar <davvid@gmail.com>
This brings back the old rescan button. We hide the button whenever
inotify is available since rescan is automatic on linux.
Signed-off-by: David Aguilar <davvid@gmail.com>
By using GIT_EXTERNAL_DIFF we can make git-difftool support any
option supported by 'git diff'. This makes git-difftool much more
useful since it can now handle any type of diff,
e.g. worktree vs. index, worktree vs. commit, commit vs. commit, etc.
'git-difftool-helper' is invoked by git and handles all of the
git configuration and merge tool finding logic.
Signed-off-by: David Aguilar <davvid@gmail.com>
We lost the ability to launch git-cola from its source tree when we
fixed things up for Windows. It would work if you were sitting in
the cola source tree, but not if your current directory was somewhere
else.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now automatically install the bin/cola win32 wrapper script.
This is now the only recommended way to run cola. Installing
cola on Windows is now no more difficult then unzipping a tarball
and running the 'cola' shell script.
The 'cola' wrapper script is now smarter in that it checks for
both Python2.5 and Python2.6, thus cola can now run with either
version.
Signed-off-by: David Aguilar <davvid@gmail.com>
It doesn't make sense to have a toolbar until we have more buttons
in there. The 'View Log' functionality was moved to the 'File' menu.
Signed-off-by: David Aguilar <davvid@gmail.com>
Calling exec_ makes it so that the parent window cannot be
raised above the child window. This removes all exec()
calls to prevent this.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now pass the parent view to the search dialog so that it can
properly center its window on the screen.
Signed-off-by: David Aguilar <davvid@gmail.com>
We work around the bug by suppressing all lines that mention
'sortingenabled' in the generated .py files.
Signed-off-by: David Aguilar <davvid@gmail.com>
The previous commit works around pyuic4 installations that are
missing shebangs, so we shouldn't mention it in INSTALL anymore.
Signed-off-by: David Aguilar <davvid@gmail.com>
Some installations of pyqt4 have a copy of pyuic4 that's
missing the shebang line. Guard against this by using
popen() instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-sh-setup is no longer in $PATH as of git 1.6.0.
Prepend PATH with git-sh-setup so that git-difftool
can use git-sh-setup.
Signed-off-by: David Aguilar <davvid@gmail.com>
Building cola for windows involves a little bit of voodoo.
We now keep all of the windows-specific scripts and such
in the win32/ folder to help make living in windows-land
a little easier.
Signed-off-by: David Aguilar <davvid@gmail.com>
We no longer mention the 'file' command now that
utils.ident_file_type() uses only mimetypes and filenames
when guessing file types.
Signed-off-by: David Aguilar <davvid@gmail.com>
There was an earlier version of git that would report files as
being modified when only their modification times changed.
This causes cola to report false-positives in its modified
files list. We now guard against this by refreshing the index
in cola's get_workdir_state() method.
Signed-off-by: David Aguilar <davvid@gmail.com>
When changing the number of results in the compare dialog down
to a number less than the index of the currently selected
filename then it would generate a traceback. We now detect
this condition and behave accordingly.
Signed-off-by: David Aguilar <davvid@gmail.com>
The font handling in the options dialog had some small
annoyances that have now been fixed. The dialog should now
show instantaneous results and properly react to all user
input.
Signed-off-by: David Aguilar <davvid@gmail.com>
If someone has a git config such as:
[color]
ui = on
Then git might ignore whether a TTY is attached when printing diffs.
We now guard against this by passing --no-color to all 'git diff'
invocations.
Signed-off-by: David Aguilar <davvid@gmail.com>
The main view needed to be updated to reflect the changes to the
main.ui interface file. This fixes a bug in the stash view.
Signed-off-by: David Aguilar <davvid@gmail.com>
We recently lost the ability to compare changes to just a single file
across commits. This has been reinstated.
Signed-off-by: David Aguilar <davvid@gmail.com>
When setting a text field Qt triggers a callback. We catch this callback
and update our model accordingly. When the model updates, it triggers
another callback which causes a feedback loop that eventually resolves
with the text field getting set twice. This is problematic since
it makes entering text problematic.
We now detect this situation and stop the notification loop accordingly.
Signed-off-by: David Aguilar <davvid@gmail.com>
Users could enter erroneous settings in their .git/config.
For example:
[merge.tool]
meld
git config --list returns that entry without an "=" sign, which
was crashing cola. We now ignore these entries.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were resetting the user input whenever it changed, so we now
only reset it when it was changed as a result of clicking on a
remote branch.
Signed-off-by: David Aguilar <davvid@gmail.com>
Previously we used QFileDialog.getSaveFileName() and restricted
users from selecting existing directories.
We now use getExistingDirectory and assume that the destionation
directory should just be the basename of the git url.
We could prompt again, but that would be annoying. Unfortunately
Qt doesn't have a convenient dialog to allow both existing
directories and new directory names (most of the world is centered
around files, it seems, unlike git which is more dir tree-ish).
Signed-off-by: David Aguilar <davvid@gmail.com>
qtextedits unconditionally eat \r\n when returning the selection.
This breaks the interactive staging on files that contain \r\n.
If we're not able to find the selection in the diff then we know
that this has happened so simply replace \n with \r\n and try
again.
This fixes interactive staging on repositories that contain
windows/dos text files.
Signed-off-by: David Aguilar <davvid@gmail.com>
When trying to search something, git-cola complains:
> AttributeError: Parameter 'commit_list' not available for Model
Attributes for class "Model" must not be null to be detected as a parameter.
Model.get_param_names has the related code to check if it is a parameter
or not.
So, the solution here is initialize model.commit_list with an empty array,
because it is similar to the data used there.
Signed-off-by: David Martínez Martí <deavidsedice@gmail.com>
When a file is deleted locally and changed on the remote side diff-index
reports the state as 'A' (added) since it's going to add it during the merge.
We now detect this and list it as an unmerged file.
Signed-off-by: David Aguilar <davvid@gmail.com>
The defaults module was removed in the process of refactoring the gui
settings save/restore functionality.
Signed-off-by: David Aguilar <davvid@gmail.com>
This retrofits git-cola to use the new core encoding module.
This centralizes all of the encoding duties so that we can modify them
as needed.
Signed-off-by: David Aguilar <davvid@gmail.com>
This creates generic core.encode() and core.decode() routines from the
encoding-guessing patch provided by David Martínez Martí.
Signed-off-by: David Aguilar <davvid@gmail.com>
Git can handle any type of file, whatever encoding it uses
(or a broken one). Git-cola must not fail (or complain) when
trying to show that data.
Git-cola only handles utf8 in diffs, which is not very useful
when your project has different encodings.
This patch adds a very simple encoding guess for each line.
Do not try to do this at the whole file, because it is useful
when you are viewing a diff of a encode change.
Signed-off-by: David Martínez Martí <deavidsedice@gmail.com>
This simplifies both the code creating the context menus and improves the
order in which items appear in the menu. This moves the common operations
to the top of each context menu permutation and adds separators to delineate
less common/dangerous operations.
Signed-off-by: David Aguilar <davvid@gmail.com>
Accidentally staging an unmerged file loses the ability to launch
git mergetool on the unmerged path. This disables the convenient
staging UI shortcuts for unmerged paths so that someone doesn't
accidentally stage a file they are still merging.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-cola now provides a repository status view that closely matches the
output of 'git status'.
The staged and unstaged lists were replaced by a single tree view.
Likewise, rest of the UI was simplified to account for this --
e.g. there are no more dock widgets in use.
New icons were added for the Staged, Modified, and Unmerged categories.
Signed-off-by: David Aguilar <davvid@gmail.com>
Previously, we would only import new merge messages at startup.
We now 'git hash-object' the merge messages and import new ones
whenever the hash changes.
Signed-off-by: David Aguilar <davvid@gmail.com>
The latest msysgit expects argv to contain "git" even though the argument
to os.spawn is "git.exe". Interesting.
Signed-off-by: David Aguilar <davvid@gmail.com>
unix can still kick us with an EINTR so we have to retry read() calls.
This is known to workaround a problem on OSX but it likely exists
other places too.
Signed-off-by: David Aguilar <davvid@gmail.com>
we'd like to avoid using the shell at all costs.
If we enable shell=True on darwin then we also have to
shell_quote, but not on win32! what a tangled mess cross-platform
IPC introduces.
Signed-off-by: David Aguilar <davvid@gmail.com>
On osx select gets interrupted and exec'ing out commands fails.
We now retry the system call to recover.
Signed-off-by: David Aguilar <davvid@gmail.com>
Older versions of git don't let you refer to remotes as refs,
so don't do that. Newer gits resolve "origin" to "origin/master".
Signed-off-by: David Aguilar <davvid@gmail.com>
Previously, model would only export attributes that it knew about
due to a create() call. It now determines parameter names dynamically
by filtering __dict__ with some simple rules.
Signed-off-by: David Aguilar <davvid@gmail.com>
The model.foo_item now contains the selected item corresponding to the foo
list/tree widgets. using foo_item vastly simplifies things.
Signed-off-by: David Aguilar <davvid@gmail.com>
This removes some duplicated code and makes the GUI better
by removing the tags option from the pull field
(--tags is a fetch and push-only thing).
Signed-off-by: David Aguilar <davvid@gmail.com>
We used to previously bail out when we were launched from a non-git repo.
This makes it so that we launch an open-directory dialog instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
git.Git() now contains a _git_cwd entry member which is separate from
_git_dir and _work_tree. This will let us refactor the way app startup
is handled.
Signed-off-by: David Aguilar <davvid@gmail.com>
If you launch git-difftool from the right-click context menus it now takes
the value of the New Commit / Amend Last Commit radio buttons into account
when creating the difftool command.
The biggest difference is that a completely staged file launches with
--commit=HEAD. When amending, we launch difftool with --commit=HEAD^.
Signed-off-by: David Aguilar <davvid@gmail.com>
This reworks git-difftool so that the command invocations are slightly
closer to git-mergetool. One big difference is that we show things from
oldest to newest when there are changes in both the worktree and the index.
In that case:
BASE=the latest commit
LOCAL=the index
REMOTE=the worktree
Certain diff commands were adjusted so that they would show these three
states in a left-to-right progression since that made most sense to
english speakers.
Signed-off-by: David Aguilar <davvid@gmail.com>
We don't want to accidentally stage a file that's unmerged so this removes
the option from the right-click context menu. We also fixed a bug where we
were launching git-mergetool with '--', which it does not support.
Signed-off-by: David Aguilar <davvid@gmail.com>
git status is a porcelain so we shouldn't rely on its output.
Change things so that we use diff, diff-index and ls-files to determine
what's changed, staged, unmerged, and untracked.
Signed-off-by: David Aguilar <davvid@gmail.com>
If a file is created in two branches then it won't exist in the index (yet)
but will be valid for diffing. git-difftool now handles this case.
Signed-off-by: David Aguilar <davvid@gmail.com>
These changes improve unicode support so that commit messages,
etc. can be written in non-english languages. These changes
make it possible to commit Japanese (and other text) into a
utf-8 project. We may need to modify things so that we use
the git project's default encoding in the future.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were passing in a list of changed files instead of passing
the items in as the args to git.add(). We now do the handle
this correclty. This also turns on git-add's verbose mode
so that better feedback is given.
Signed-off-by: David Aguilar <davvid@gmail.com>
If we double-clicked on a file in the file list then we don't
need to relaunch difftool when the 'Ok' button is clicked.
Otherwise, the 'Ok' button launches difftool and closes the
file list.
When comparing against another branch you can now double-click
on the file list to launch a comparison against that file.
This is nicer since you can now launch multiple comparisons at once.
Signed-off-by: David Aguilar <davvid@gmail.com>
Less-commonly used and advanced entries have been moved into sub-menus.
This makes things easier to understand and visually cleaner.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'compare commits' gui now remembers the selected treewidget items and
restores them whenever we change things such as the number of results or
the 'show version numbers' checkbox.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now pre-select the second-to-last commit as the start and the
latest commit as the end commit by default.
This makes it so that the 'compare commits' gui is setup to show the
differences between HEAD^ and HEAD by default.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now filter out old renamed file names from the file differences list.
This is better since the only names that are listed are the final,
surviving names in the end revision.
Signed-off-by: David Aguilar <davvid@gmail.com>
git difftool --start=<rev> --end=<rev> -- <filename> would not show
the correct diff for renamed files. With this change it now follows renames
and shows the correct diffs.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds the ability to load a commmit template from the file menu.
A default commit template can be set using the commit.template git
config variable.
Signed-off-by: Barry Roberts <blr@robertsr.us>
The compare commits GUI is now simpler and gives users a more
streamlined workflow. The GUI now shows the file differences
up front and does away with the intermediate file selection dialog.
Signed-off-by: Matthew E. Levine <melevine@disneyanimation.com>
You can diff files that don't exist in either the starting or ending revision.
We previously bailed out of when that occurred. We now provide empty files
to diff against since that is more consistent.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now properly handle comparing against files that do not exist
in the current checkout. The current behavior is to show a diff
between an empty file and the file as it existed in the other commit.
Another possibility could be that we just ignore that file altogether...
Signed-off-by: David Aguilar <davvid@gmail.com>
git-difftool was pretty sparsely commented.
These new comments clarify a few small details and don't clutter
an otherwise straightforward script.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-difftool now uses a SIGINT handler to clean up after someone control-c's
out of git-difftool.
The cleanup routines were also improved so that no transient files are ever
left behind.
Signed-off-by: David Aguilar <davvid@gmail.com>
The safest thing to do is to never change the state of the index.
This effectively makes git-difftool a read-only viewer, though the user
always has the option of saving to $MERGED if they want to.
Signed-off-by: David Aguilar <davvid@gmail.com>
An overridden tr() method was added to the main controller that
routes things through the main qapp instance.
Signed-off-by: David Aguilar <davvid@gmail.com>
When 'Show Versions' is enabled the descriptions in the compare view get the
canonical 'git describe' version number prepended to them.
Signed-off-by: David Aguilar <davvid@gmail.com>
All of the pyuic4-generated classes now live under cola.gui.*
cola.views is now reserved for subclasses and hand-rolled guis.
Signed-off-by: David Aguilar <davvid@gmail.com>
'git config --global --list' mashes all config variables into lowercase
names, so we need to use merge.keepbackup instead of merge.keepbackup.
Signed-off-by: David Aguilar <davvid@gmail.com>
With these changes it is now possible to compare commits relative to a
specific commit. This is basically an extension of the 'Compare Commits'
functionality.
Signed-off-by: David Aguilar <davvid@gmail.com>
From: Barry Roberts <blr@robertsr.us>
Launching executables (diff editor, editor, etc.) was busted on Windows.
This fixes it.
Signed-off-by: David Aguilar <davvid@gmail.com>
We accidentally lost all of the menu actions from the 'Repository' menu
during the last round of refactoring. This reinstates those actions, though
the respective actions are now in the Commit and Branch menus.
Signed-off-by: David Aguilar <davvid@gmail.com>
The '#!/usr/bin/env python' is good enough so we can make setup()
leave it alone by changing the regex it uses when searching for shebangs.
Signed-off-by: David Aguilar <davvid@gmail.com>
When rev-range mode is on we now check for the existence of directories
and files and handle their presense accordingly. We now handle creation of
directories that don't exist in the current checkout (do to older ancestry).
Signed-off-by: David Aguilar <davvid@gmail.com>
By using Commit -> Compare Commits you can use git mergetools
for showing differences between arbitrary commits.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes it so that the column display is initialized at startup instead
of when the user enters the first text into the commit message editor.
Signed-off-by: David Aguilar <davvid@gmail.com>
Selecting the first or last line was not getting properly handled.
This fixes an off-by-one error for the offset and avoids using split
when there is nothing to split.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds a column number label to the commit message editor to show
the column position of the text cursor. This is useful since the commit
message editor is a WYSIWG editor for commit messages.
Signed-off-by: David Aguilar <davvid@gmail.com>
The common case (no changes in the index) was creating a
three-way merge when it should have done just two-way.
This is because --cached doesn't make sense when comparing
against a commitish.
Signed-off-by: David Aguilar <davvid@gmail.com>
When viewing grep results you can now right-click and select
'Go Here' to launch $EDITOR on the files found in the grep results.
Signed-off-by: David Aguilar <davvid@gmail.com>
If users specify a custom stylesheet we now register all
immediate subdirectories with QtCore.QDir.
This makes it possible to use resources and styles outside
of the git-cola installation path.
Signed-off-by: David Aguilar <davvid@gmail.com>
Lots of cola code is now simpler since we're using our new
custom git-difftool command.
Several config variables changed since there is no longer a
concept of a "diffeditor." gui.diffeditor was replaced by the
standard merge.tool variable, etc.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-difftool allows using mergetools for staging changes.
This is used by the 'launch diffeditor' functionality.
Signed-off-by: David Aguilar <davvid@gmail.com>
Consequently, we can now run bin/git-cola from the source tree
without needing run make install.
The tests and bootstrap scripts were updated to reflect this.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'Amend Last Commit' radio button now does everything that you
would expect it to do. The gui now shows the amended status, etc.
Signed-off-by: David Aguilar <davvid@gmail.com>
The test suite used to require you to install cola before testing.
The cola tests now use the build/lib directory instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
waf is python and it's great but unfortunately most people are
not familiar with it. Setuptools is the standard Python way of
doing things, so it makes sense to switch. This makes
packaging simpler too since debian is quite keen at handling
projects that use setuptools.
Signed-off-by: David Aguilar <davvid@gmail.com>
This makes things more tidy since we don't have to expose these maintenance
scripts in the main branch.
Signed-off-by: David Aguilar <davvid@gmail.com>
We were mixing single and double quotes.
Double quotes should only be used when the string itself
contains single quotes.
Signed-off-by: David Aguilar <davvid@gmail.com>
main.set_info() now handles the translation call so this
patch removes the calls to tr() from the calling side.
Signed-off-by: David Aguilar <davvid@gmail.com>
dark.qss now provides an example showing how to set the syntax
highlighting colors. They colors are properties that are added
to specific widgets. These properties are queried at runtime to
create the syntax highlighting colors.
Signed-off-by: David Aguilar <davvid@gmail.com>
this makes the ui less quirky since it no longer tries to guess what
the correct horizontal or vertical setting should be.
Signed-off-by: David Aguilar <davvid@gmail.com>
These actions undo changes to the work tree by calling
'git apply'. This builds upon the diff selection gui
and lets you manipulate your work tree using the same
interface.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now detect unmerged files and return the correct diff.
We were previously using --patch-with-raw, which we don't want to
do for unmerged entries since it ends up not giving us a patch ;)
Signed-off-by: David Aguilar <davvid@gmail.com>
Previously, every time rescan() was called we would prompt the user
asking if they wanted to import the merge message. We now prompt
once and only once.
Signed-off-by: David Aguilar <davvid@gmail.com>
Previously, the main interface shunned having a central
widget in favor of purely having dock widgets in the
dock areas. Since I haven't figured out how to make
a splittable dock area be the central widget, I made
the status widget the central widget and placed all of
the other windows in the left dock area.
TODO: figure out whether we can have a nice splittable,
dockable layout. It was possible in qt3, but it does seem
like some of this functionality might not be accessible
from python.
Signed-off-by: David Aguilar <davvid@gmail.com>
You can now select File -> Clone, enter a URL and
target directory, and a new session of cola is
launched from the clone.
Signed-off-by: David Aguilar <davvid@gmail.com>
For some reason osx gets an interrupted system call
when using subprocess.Popen. This avoids that problem.
Signed-off-by: David Aguilar <davvid@gmail.com>
cola now works on bare repositories and symlinks.
Running cola on a non-git directory will now
print a friendly message instead of a stacktrace.
Signed-off-by: David Aguilar <davvid@gmail.com>
We also remove some waf crud about files not being chmod +x
(probably some stupid svn thing or an old waf version).
The makefiles are now portable in that they don't hardcode
the current directory anymore.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-cola now has a mergetool option in the
right-click menu when running on non-macos,
non-windows platforms.
The reason for blocking out windows and macos
is that there is no simple way to spawn a terminal
for the interactive mergetool session.
We could, of course, write our own mergetool wrapper
in Python, but this is the easiest way for now.
Signed-off-by: David Aguilar <davvid@gmail.com>
Something changed in PyQt where all of the localization
strings had dialog-specific contexts in their names
when passed to qApp.translate(). Since we're using
simple .qm files (without any context) the fix is to
simply blank out the context when calling translate.
Signed-off-by: David Aguilar <davvid@gmail.com>
Setting cola.editdiffreverse will cause cola to launch:
$diffeditor $tmpfile $filename
instead of the default:
$diffeditor $filename $tmpfile.
$tmpfile points to the contents of:
git show HEAD:$filename
Signed-off-by: David Aguilar <davvid@gmail.com>
* master:
README: update the build instructions to mention GitPython
build: teach the build scripts about the bundled GitPython
tests: use the interal git module
cola: switch to using the internal git module
cola: include GitPython to make installation simpler for users
syntax: improve the whitespace checker
This removes the requirement notice on GitPython since it is
now built in to git-cola. An acknowledgements was added instead.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now ship a copy of GitPython so that users don't have to install
it themselves. Another benefit is that we're shielded from API changes.
Signed-off-by: David Aguilar <davvid@gmail.com>
Previously, the syntax checker would only complain about the
final trailing whitespace character. It now flags all of them.
Signed-off-by: David Aguilar <davvid@gmail.com>
* master:
utils: rework fork()
models: fix (fetch|push|pull)_helper
style: do the mainstream python thing and use spaces instead of tabs
syntax: use nicer colors for the diff display
We were getting some backtraces when launching apps in the
background with the subprocess-based fork() method.
This reworks the implementation to avoid subprocess.
The downside is that we now rely on shell_quote().
I'm probably doing something wrong, or there's some weirdness
introduced when running under PyQt.
Signed-off-by: David Aguilar <davvid@gmail.com>
This lets users launch a diff editor against files that are different
between their work tree and a specific branch.
Signed-off-by: David Aguilar <davvid@gmail.com>
There are now two simple dialogs for quickly
selecting items from a list. One uses a qlistwidget
and the other uses a combobox.
Signed-off-by: David Aguilar <davvid@gmail.com>
git-cola now keeps temp files around until
the application is shut down.
This is more convenient since we no longer
have to worry about unlinking files.
Signed-off-by: David Aguilar <davvid@gmail.com>
GitPython removed get_git_dir() and get_work_tree().
git.Git() now requires that a path is passed to it as well.
All of cola's interaction with GitPython is now isolated
to the GitCola class. This commit adds these useful
methods to the GitCola class.
Signed-off-by: David Aguilar <davvid@gmail.com>
* master:
controllers: generalized the diff gui for 'Apply Diff From Branch'
stash: update to the latest GitPython API
models: add an 'apply_diff_to_worktree' function
utils: generalize the diff parser
ui: add an Apply Diffs From.. option to the branch menu
models: update to the latest GitPython API
utils: add branch/rev support to the DiffParser class
models: add branch/rev support to diff_helper
GitPython: updated to use Govind's latest GitPython changes
The diff gui can now apply diffs against arbitrary revisions.
This makes it possible to use git cola to do things like diff
branches, remotes, etc.
Signed-off-by: David Aguilar <davvid@gmail.com>
apollo13 changed GitPython so that with_exceptions=True
is the default. Also, with_stderr no longer exists.
Instead, we can use with_extended_output.
Signed-off-by: David Aguilar <davvid@gmail.com>
format_patch_helper now creates patches that are suitable
for using with "git send-email patches/"
Commits that are selected in a range are exported as a
series of commits. Single commits are exported individually.
Signed-off-by: David Aguilar <davvid@gmail.com>
This adds the rest of the normal git commands so that git.<cmdname>
is available at import time for just about every git command available
from the cmdline.
Signed-off-by: David Aguilar <davvid@gmail.com>
Even though the docstring is never seen, it still serves
as good documentation for the module's interface.
Signed-off-by: David Aguilar <davvid@gmail.com>
When running "configure" the waf script might be running under a different
version of python than the target for which python we're building.
We now detect "env PYTHON=/usr/bin/python2.4 waf configure" overrides.
Signed-off-by: David Aguilar <davvid@gmail.com>
The git porcelain shell-wraps filenames with shell meta-characters.
We now detect this and use python's eval() to recover the
original filename.
Signed-off-by: David Aguilar <davvid@gmail.com>
This is a simple script to compile python
files into .pyc/.pyo files. It will be used
by the debian makefiles.
Signed-off-by: David Aguilar <davvid@gmail.com>
git.py is now installed in the standard python
site-packages directory. This means that it is
possible to merely say:
import git
to access the git.py module.
Signed-off-by: David Aguilar <davvid@gmail.com>
run_cmd and friends were moved to git.py.
Make utils redirect callers to git.py for
run_cmd and get_tmp_filename methods.
Signed-off-by: David Aguilar <davvid@gmail.com>
The git.py module is now dependent on Python only.
Previously, it depended on the ugit.utils and PyQt4.QtCore
modules. All process management is handled by subprocess.
Signed-off-by: David Aguilar <davvid@gmail.com>
"make test" now prints a summary at the end of a run.
"make test" exits on the first error it encounters.
To force running all tests, use:
make RUN_ALL=1 test
Signed-off-by: David Aguilar <davvid@gmail.com>
This is so you can use the "=" symbol inside .gitconfig without raising a
ValueError.
Git seems to parse lines in gitconfig like:
work-week = log --author=Kelvie --since=last.sunday
without any issue, so this seems appropriate.
Signed-off-by: Kelvie Wong <kelvie@ieee.org>
This fixes an infinite recursion when loading the
SettingsModel() since that model's init() method
calls self.load(...)
Signed-off-by: David Aguilar <davvid@gmail.com>
Previously, the logic for serializing/deserializing to/from dictionaries
did not properly deal with lists of hashes, hashes of lists, lists, etc.
The core model can now handle any arbitrarily complicated structure.
The core to_dict() routine recursively walks the object structure
without the need for external data for tracking parameter types.
Signed-off-by: David Aguilar <davvid@gmail.com>
The following form is now valid:
git ugit /repo/path-1 /repo/path-2 ... /repo/path-N
A new ugit session is spawned for each repo.
Signed-off-by: David Aguilar <davvid@gmail.com>
double-clicking in the revision list will now run
git format-patch on the selected revision.
some small quirks with the ui were also fixed.
Signed-off-by: David Aguilar <davvid@gmail.com>
The goal of these changes is to allow runtime creation
of arbitrary git commands. e.g. git.branch() should
return the output of "git branch." We do this by
using a module dispatcher/__getattr__ to intersept
attributes. Eventually, the git.py module should
be very tiny as the hand-coded methods are
phased out.
Signed-off-by: David Aguilar <davvid@gmail.com>
Find by revision now returns multiple results and
allows the user to browse the found/matching commits.
Signed-off-by: David Aguilar <davvid@gmail.com>
ugit now raises the diff dockwindow when the view_diff()
action is triggered. This works regardless of whether the diff display
is a standalone window or if it is in a hidden dock tab.
Signed-off-by: David Aguilar <davvid@gmail.com>
ugit can be launched on projects in a different path
by pass --project /path/to/git/repo.
ugit --version now reports the current ugit version.
Signed-off-by: David Aguilar <davvid@gmail.com>
The gui is now fully fluid. Widgets can be placed anywhere and
torn off separately. The "Horizontal Status" checkbox now controls
whether the status view is layed out horizontally or vertically.
Signed-off-by: David Aguilar <davvid@gmail.com>
ugit now supports a flag to enable saving window settings:
ugit.savewindowsettings
whether to save these settings at exit is controlled by:
ugit.saveatexit
The git config interaction was also refactored so that the config
parsing is done entirely within the git module.
Signed-off-by: David Aguilar <davvid@gmail.com>
The main gui now has a fluid layout with widgets that can be
arranged and docked/undocked at runtime. Support for saving
layouts will need to be reimplemented.
Signed-off-by: David Aguilar <davvid@gmail.com>
model.get_modified() should make more sense than get_changed() since
modified is how git refers to these files in the documentation.
Signed-off-by: David Aguilar <davvid@gmail.com>
The initial version of reselect-on-rescan was using the modified items
from the model instead of modified + untracked.
Signed-off-by: David Aguilar <davvid@gmail.com>
We now restore the active selection when rescans occur. Previously we would
lose the selection list and the scrollbar positioning. All of these are now preserved.
Signed-off-by: David Aguilar <davvid@gmail.com>
Clicking a file's icon in the listview will now trigger the same action that
would happen if the row were double-clicked.
Signed-off-by: David Aguilar <davvid@gmail.com>
Right-clicking on the unstaged item list now displays two menu choices:
Stage Selected
Undo Local Changes
"Undo Local Changes" checks the file out from HEAD, thus dropping all
uncommitted changes. The user is prompted before proceeding with
this action.
Signed-off-by: David Aguilar <davvid@gmail.com>
The 'git status' parser now uses regexes that are not dependent on
the variable whitespace present in git's output.
Signed-off by: David Aguilar <davvid@gmail.com>
ugit.py was adjusted to account for __file__ not being available when
using py2exe. The py2exe setup scripts were provided by Sebastian for
inclusion with the win32 release. scripts/build-win32.sh was adjusted
accordingly.
Signed-off by: David Aguilar <davvid@gmail.com>
Subclasses are no longer required to call model_to_view. If the convention of naming
view widgets the same as the model's parameters is followed, then a lazier
add_observables call can be used. This is now used consistently throughout ugit.
Signed-off by: David Aguilar <davvid@gmail.com>
script-ugit-cygwin.sh had a typo. A better solution (that works on both cygwin and msys)
was proposed and added as ugit-win32.sh. That script replaces both of the old ones.
Signed-off by: David Aguilar <davvid@gmail.com>
The interactive diff gui menu actions were still enabled when displaying a diffstat or
index. The controller now tracks whether it's ok to enable patch selection,
and disables it for diffstats/index views.
Signed-off by: David Aguilar <davvid@gmail.com>
This action displays the current state of the index in the diff window.
Basically, a syntax-highlighted view of git diff --cached --unified=<n> --stat
Signed-off by: David Aguilar <davvid@gmail.com>
This patch teaches the DiffSyntaxHighlighter to highlight git diffstats.
This was purely done by adding a new rule to the highlighter.
The GenericSyntaxHighlighter was also fixed to allow empty matches.
Some of the format variable names were changed to improve readability.
Signed-off by: David Aguilar <davvid@gmail.com>
Any invocation of add_callbacks or model_to_view will now automatically handle
add_signals invocation for the widget of interest. This removes almost every
explicit call to add_signals. autoconnect() methods were added to the QObserver
to help facilitate this functionality.
Signed-off by: David Aguilar <davvid@gmail.com>
Now that the action dispatcher properly behaves, update the controllers to use it
instead of using direct Qt signal/slot connections.
Signed-off by: David Aguilar <davvid@gmail.com>
Previously, hitting ESC to exit out of the options gui was not properly notifying
the main app about needing to update/revert the fonts back to their original values.
This fixes that problem and removes some code by specifying the connection between
the optionsgui.cancel_button signal and the optionsgui.reject slot in the ui file.
We then catch the reject signal in the controller and handle that. The reason it
didn't work previously is that we were only handling the case were cancel was pressed
instead of explicitly handling the rejected() signal.
Signed-off by: David Aguilar <davvid@gmail.com>
Using "helvetica" and "*mono" as the font names is better since
those are understood and translated into their native variants
on both Linux and OSX.
Signed-off by: David Aguilar <davvid@gmail.com>
Previously, actions were only launched when there was a mapping between a model
parameter and a view widget. Now, it is only necessary to register an action
with add_actions--model->view mapping is optional.
Signed-off by: David Aguilar <davvid@gmail.com>
Previously, if python-pyinotify was not installed we would we present the user
with a messagebox informing them of this fact everytime the app is launched.
This changes it so that the nag message is only printed to log only.
Signed-off by: David Aguilar <davvid@gmail.com>
If no font is specified for the font combo box then no font will be listed for
the diff font. Set a selected font so that the field is always populated.
This only affects the case where a user has never previously selected a font.
Signed-off by: David Aguilar <davvid@gmail.com>
Use bold+black for informational: lines. This makes it easier to see the note versus
the informational text.
Signed-off by: David Aguilar <davvid@gmail.com>
Removed the line-wrapping so that it's obvious that the commit
text editor is WYSIWYG wrt commit messages.
Signed-off by: David Aguilar <davvid@gmail.com>
Added Repository->Show Revision
This menu item lets you search for revisions using a text input. The first revision matching the query string is displayed in the gui. If the sha1 doesn't match any commits, we look for a blob or tree that matches the sha1 and display it.
Signed-off by: David Aguilar <davvid@gmail.com>
After the crlf fervor dies down we can add support for whatever crazy scheme is needed on windows. until then, unix wins (and so does \n).
Signed-off by: David Aguilar <davvid@gmail.com>
We now change the disabling of model notification in when setting Qt widget params instead of when setting model params. This undoes a previous fix that was added to the options controller that would refresh the historybrowser line in the options gui. That code is no longer needed with this change. An added benefit is that the interactive font updating is fixed/enabled with this fix.
Signed-off by: David Aguilar <davvid@gmail.com>
Previously all of the commit-browsing guis (export patch/cherry-pick) would have the title of "git commit browser". The title is now set to the current action.
Signed-off by: David Aguilar <davvid@gmail.com>
We now set minimum sizes for many widgets so that the gui can be sized smaller than before (if desired).
Marco noticed some layout issues when maximized. These were fixed by changing the size policies for the widgets. Overall, the design is better in that widgets are being used to contain layouts instead of using nested layouts.
Signed-off by: David Aguilar <davvid@gmail.com>
Renamed the historybrowser config name to match the other config names.
Added the historybrowser parameter to the allowed list so that it is serialized into git config.
Added the historybrowser param to the refreshview method of the optionscontroller so that it is properly read on startup.
Signed-off by: David Aguilar <davvid@gmail.com>
Instead of hard linking gitk let the user set
the preferred history visualization tool in settings dialog.
Signed-off by: Marco Costalba <mcostalba@gmail.com>
More commands report information in the log window now.
Disabled whitespace checks in the commit browser. They're always turned on in the diff gui, which is where it really matters.
Signed-off by: David Aguilar <davvid@gmail.com>
We previously made it so that the OutputGUI's log method always sets the cursor at the beginning of the document. This isn't that nice since the side-effect is that the document gets scrolled to the end. Let's keep the cursor at the end so that users will see the end of the log (which is where the most recent/useful information is found).
Signed-off by: David Aguilar <davvid@gmail.com>
Squashed commit of the following:
commit 06f4dc70817f9178ca4086c0ee52c9fee41852bb
Author: David Aguilar <davvid@gmail.com>
Date: Thu Jan 3 01:00:11 2008 -0800
Fixed some corner cases in the log find functionality
When logging output the cursor defaults to the end of the document. This made the search method hit the end of the document before ever trying any searches. When doing OutputGUI().log(..) we now reset the cursor to the beginning of the document.
commit 17858c1367fe8ce9e1760ec7055edbd128db210a
Author: David Aguilar <davvid@gmail.com>
Date: Thu Jan 3 00:35:44 2008 -0800
Add a syntax highlighter for the log window
* Generalized the syntax highlighting logic into a GenericSyntaxHighlighter class.
* Refactored the DiffSyntaxHighlighter to use the new generic highlighter as a base class.
* Added a new LogSyntaxHighlighter which is also based on GenericSyntaxHighlighter.
commit 41c6a104bbaa9d5eb4f556692c66e40307346179
Author: David Aguilar <davvid@gmail.com>
Date: Wed Jan 2 21:42:20 2008 -0800
Removed line wrapping in the diff display
commit 1f72566562c90170667b43ef8d2a67bdbd8eb77a
Author: David Aguilar <davvid@gmail.com>
Date: Wed Jan 2 21:30:12 2008 -0800
Added an output log window
commit 8bedf5b90b9e3fcf8a06a97e526c22f8456f498c
Author: David Aguilar <davvid@gmail.com>
Date: Wed Jan 2 19:00:36 2008 -0800
Updated README
commit 108744ec87a197749d478c7a4bd62a05d7e79095
Author: David Aguilar <davvid@gmail.com>
Date: Wed Jan 2 05:48:05 2008 -0800
Added a first draft of the logging window
commit d5c78d616b6f9656a7df063a6bd97477ae5d76c5
Author: David Aguilar <davvid@gmail.com>
Date: Wed Jan 2 05:07:58 2008 -0800
Renamed GUI attributes so that everything follows a names_with_underscores style.
commit 713a88a125ebb84b607675ff1c3840d691812f65
Author: David Aguilar <davvid@gmail.com>
Date: Wed Jan 2 00:54:44 2008 -0800
Ensure the toolbar defaults to the bottom of the screen, but allow nesting at the top
commit 2e905b798ef251f4aef30cb957c61fceb3e1537f
Author: David Aguilar <davvid@gmail.com>
Date: Wed Jan 2 00:29:15 2008 -0800
Removed the statusbar, replaced with toolbar for the log window
Signed-off by: David Aguilar <davvid@gmail.com>
Squashed commit of the following:
commit ed32c76a8fb4164d93198503c791ff3ed56850a4
Author: David Aguilar <davvid@gmail.com>
Date: Tue Jan 1 08:28:22 2008 -0800
Remove model.clone(init=False) hack
commit 2c3518bd55648c23ea86d1165945f4cd398b6049
Author: David Aguilar <davvid@gmail.com>
Date: Tue Jan 1 08:17:37 2008 -0800
Use the preferred diff font in the export patch gui as well
commit caf530dac6ad625b9f74ff34bedfae7cc0925f9e
Author: David Aguilar <davvid@gmail.com>
Date: Tue Jan 1 08:17:06 2008 -0800
make the repo browser look a little nicer
commit 4e14d807e8e50af8326cea67c15490435b734887
Author: David Aguilar <davvid@gmail.com>
Date: Tue Jan 1 08:16:35 2008 -0800
Improve the syntax highlighter
commit 499d03d78ade84f37705fe60232c39e069054893
Author: David Aguilar <davvid@gmail.com>
Date: Tue Jan 1 07:49:51 2008 -0800
Implemented an option save/restore interface to git config
commit ca7c0fc78b54fa05f18ee0c90fdba0d8cf8f081f
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 31 22:40:05 2007 -0800
More config system updates
Add_callbacks originally required a dictionary as its input. Now, it uses **kwargs as its dictionary so that the key=value pairs can be specified directly.
Selecting a merge commit in the patch export gui will now export all of the merge's individual commits. Selecting any of the individual commits exports just that patch.
We get this by always passing format-patch a rev .. range expression.
Signed-off by: David Aguilar <davvid@gmail.com>
The commit browser was not properly checking if a commit was a merge. In those cases, it would not display the entire contents of the commit. A new method was added to handle this case and hooked into the utilcontroller.
Signed-off by: David Aguilar <davvid@gmail.com>
Added a utilcontroller module to own simple dialogs such as choose_branch
Moved select_commits into utilcontroller
Moved browse_git_branch into the repobrowsercontroller
Removed lots of view classes from the controller module
Sped up the push dialog's init time by asking the config system for the remote url
Speed up cloning by passing constructor args to model.clone()
Signed-off by: David Aguilar <davvid@gmail.com>
Removed all dependencies on non-model modules from the controllers.
Removed usage of python's commands module.
Moved several model-centric methods into the model.
Added some helpers to the view classes.
Pushed most of the diff analysis/processing into utils.DiffParser.
Signed-off by: David Aguilar <davvid@gmail.com>
Reworked cmds.git_diff to make filename an optional parameter.
Changed controllers to pass filename to git_diff
Removed some unused vars from the controller's process_diff_selection().
Changed utils.DiffParser's logic so that including the previous line's newline in the selection will not include that line.
Signed-off by: David Aguilar <davvid@gmail.com>
With this integration, it is now possible to select sub-hunks in the diff gui.
It is now possible to select individual lines and stage those lines only.
To allow per-line selections use the "Stage/Unstage selected lines" context menus.
Signed-off by: David Aguilar <davvid@gmail.com>
This commit enforces that ugit will only ever commit what is already staged (and thus in the stagedList). Partial commits are not allowed, since that prevents partial commits.
Signed-off by: David Aguilar <davvid@gmail.com>
When a model's parameters change, and the system knows about a corresponding view widget, the mediator's action callback will now receive a reference to the view's widget when the action is called. This simplifies a common pattern in the action methods.
Signed-off by: David Aguilar <davvid@gmail.com>
Renamed a few UI items to align with git-gui's existing translations.
Added the QApplication calls to setup the translator.
Started using self.tr() in the controllers.
commit 50f517616a5e0b3391911a9f8dcb5037a1ecf4c7
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 09:25:48 2007 -0800
Updated TODO to reflect latest updates
commit 0fcfd488d56f8918e18768988d7bddcd6bc3e1b5
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 09:11:31 2007 -0800
Updated ugit controllers for the model/view refactoring
commit ef847b22072db6c2103a902d53e5852b71cef2f1
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 09:09:58 2007 -0800
Refactored model/view classes to avoid passing around the model
commit 86dbbb74334bfc8371461d2304ad7281ff56bd8c
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 09:07:19 2007 -0800
Simplify utils.grep's usage and implementation
commit 13cfb22f286124a4cb18eb8f1c04bef5c317668c
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 09:02:28 2007 -0800
Simplify view imports
Signed-off by: David Aguilar <davvid@gmail.com>
Squashed commit of the following:
commit 1f5a6e4c6b4dd47500a2a26c50334b8d1f57997b
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 05:10:15 2007 -0800
Store splitter geometry so that settings are remembered across sessions
commit b0d249887a76fb01d14d5e241b5b0bbb895feaed
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 04:46:57 2007 -0800
Separated out the info display from the diff display
commit 59660cec1b28b1a0703092974f3303a05befba70
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 04:25:45 2007 -0800
Added proper cut/copy/paste/delete/undo/redo for the commit text
commit f16f7fa212e88829ce88a749d07e9dc116c2a728
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 04:25:16 2007 -0800
Removed unused fetch+rebase menu action (TODO later)
commit 2a05bb7b66175fd14592789a513a4d735097fb0f
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 04:01:49 2007 -0800
Show the remote URL in the push dialog
commit 30c59974cb5a5305eb7a4ef1291ddc3df9333d13
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 04:01:05 2007 -0800
Added a convenient grep function
commit bf7a9144632d9ed4a61edb2ce6cb2115b85a8230
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 04:00:14 2007 -0800
Correctly handle temp build files when creating tarballs
commit c5bf345be573a1e6d851a22e1bab5bb5682512bd
Author: David Aguilar <davvid@gmail.com>
Date: Mon Dec 24 03:38:31 2007 -0800
Make ugit remember window geometry settings
Signed-off by: David Aguilar <davvid@gmail.com>
commit 84353b6fd7afeeda44a8233611286b6d2b71ca88
Author: David Aguilar <davvid@gmail.com>
Date: Sat Dec 22 04:43:52 2007 -0800
Added a Git Push dialog
commit bd69f7975dc3662042099af8e3d89ee8741cc683
Author: David Aguilar <davvid@gmail.com>
Date: Fri Dec 21 23:49:46 2007 -0800
Display project/branch in titlebar
Signed-off by: David Aguilar <davvid@gmail.com>
Right-clicking on the diff display now allows you to stage selected hunks from an unstaged diff. This was one of the main pieces of functionality missing from git-gui that is now supported by ugit.
Signed-off by: David Aguilar <davvid@gmail.com>
Use a cloned model when browsing the repo browser. This lets you several modeless repobrowsers, each viewing a different branch.
Signed-off by: David Aguilar <davvid@gmail.com>
All views now share the same model.
Added obligatory qobserver destructor to handle unregistering observers from their subjects.
Signed-off by: David Aguilar <davvid@gmail.com>
Updated the main window to display a visible cursor
Allow selection with the keyboard in the diff textedit
Ensured that utils.header() is always 80 columns wide
Signed-off by: David Aguilar <davvid@gmail.com>
Tweaked the layout a bit
Removed the shell_quote stuff from run_cmd (since QProcess doesn't need it)
Make the "export file" functionality not rely on shell redirection (this should help when running on win32)
Signed-off by: David Aguilar <davvid@gmail.com>
We now support msysgit. The environment is still kind of frankenstein
since we're using Python (native win32) + PyQt4 (native win32) + Git (msys), but somehow most of it still works.
Signed-off by: David Aguilar <davvid@gmail.com>
Change the import test to try importiny inotify from ugitlibs instead of the system's pyinotify module. Only catch ImportErrors to avoid catching real mistakes. If we're on linux, recommend installing the python-inotify module.
Signed-off by: David Aguilar <davvid@gmail.com>
Python's commands module sometimes raises IOErrors, which may be related to
signal handlers set by Qt. It is likely that Qt manipulates Unix signals,
though I did not find a reference clearly stating this. Certain signals,
notably signals related to child process handling, may cause read calls to
be interrupted. Such an interruption seems to be transformed into an
IOError by Python's commands module.
The spurious errors are know to occure on Mac OS X with
Python 2.3.5 (#1, Jan 13 2006, 20:13:11)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Using QProcess as a replacement fixes the error. Qt knows about its own
signal handler manipulations. The spurious errors are gone.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Direct calls to commands.getoutput() are wrapped in the function
run_cmd().
This is in preparation for replacing commands.getoutput with
QProcess to avoid spurious IOErrors.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Squashed commit of the following:
commit 469d388327218fa015de74b9e3ec99933847e501
Author: David Aguilar <davvid@gmail.com>
Date: Sat Dec 15 06:01:46 2007 -0800
Vastly improved the diff/repo display
Added GitSyntaxHighlighter
Changed dialogs to use the GitSyntaxHighlighter
Removed all HTML-related junk
Signed-off by: David Aguilar <davvid@gmail.com>
commit 7d8a52e25f5049a0d14c20e9009bd283c1452cff
Author: David Aguilar <davvid@gmail.com>
Date: Sat Dec 15 04:15:15 2007 -0800
Context menu
Oops! We were using rstrip()/lstrip() to remove repeated single-quotes when really we should have just taken a substring.
Signed-off by: David Aguilar <davvid@gmail.com>
Previously we were joining large chunks of text using temporary arrays.
Using a cStringIO object noticably faster.
Signed-off by: David Aguilar <davvid@gmail.com>
Squashed commit of the following:
commit 3ca04bff83504d4aa9cc14ee7511d121679b2f12
Author: David Aguilar <davvid@gmail.com>
Date: Wed Dec 12 21:33:38 2007 -0800
Removed the rescan button since there's no use for it anymore
Removed the rescan button. The Commit -> Rescan action still exists for those without inotify. Ctrl-R, as always, is still wired to the rescan action as well.
Signed-off by: David Aguilar <davvid@gmail.com>
commit 50a14f03229a6f2d4c8b8536fc4d246481f4a104
Author: David Aguilar <davvid@gmail.com>
Date: Wed Dec 12 21:30:17 2007 -0800
Added inotify support
Creating, deleting, moving or modifying files known to git now triggers
inotify events. ugit watches these events and rescans for changes
automatically.
Signed-off by: David Aguilar <davvid@gmail.com>
commit a675fbdfa87ad72d8803843e39f00505850191cf
Author: David Aguilar <davvid@gmail.com>
Date: Wed Dec 12 09:47:12 2007 -0800
ugit-notify.py for interfacing with inotify
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.