GithubHelp home page GithubHelp logo

fabioz / mu-repo Goto Github PK

View Code? Open in Web Editor NEW
275.0 17.0 33.0 986 KB

Tool to help in dealing with multiple git repositories

Home Page: http://fabioz.github.io/mu-repo/

License: Other

Python 99.53% Shell 0.41% Batchfile 0.01% Dockerfile 0.05%

mu-repo's Introduction

mu-repo's People

Contributors

bodograumann avatar cassinaj avatar dadeerh avatar fabioz avatar igortg avatar nicoddemus avatar shaqo88 avatar tcrocomo-esss avatar workswithtools avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mu-repo's Issues

git colours

How do I show colours when using this.

Especially when using mu diff

De-colorize output from git when color.ui is "always"

mu checkout master failed for me with the following:

cl-tools : git checkout master
error: pathspec '"\033[32mmaster\033[m"' did not match any file(s) known to git.

until I turned color.ui to "auto". This is more of a tip since the workaround is the default behavior, thanks for the cool code!

Support Python 3.9

With Python 3.9, deprecated isAlive method was removed.
This is still used in execute_git_command_in_thread.py line 214.

Create github pull request

It would be very useful to have a way to create github/bitbucket pull requests on all the projects automatically

Feature: repository filtering

It would be nice if the set of repositories could be filtered based on some dynamic properties. For example:

  • only operate on repositories that have a dirty status
  • only operate on repositories in which a branch exists
  • only operate on repositories where a passed shell command returns a 0 exit status
  • etc.

It would be a kind of dynamic grouping function.

command 'gc' has no effect in parallel mode

First of all, great thanks for your providing this nice tool.
Thanks to mu-repo, now I can better manage multiple git repositories in a more systematic way.

The git command 'gc', however, seems to have no effects when running it by "mu gc" as shown below:

> mu gc

  Bin : git gc

  Learning : git gc

  Research : git gc

  dotFiles : git gc

  elisp : git gc 

Running 'gc' through git aliases throught the stackoverflow solution suggested by Jose Luis Blanco, however, result in the following:

> git all gc
Bin/.git
Counting objects: 65, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (47/47), done.
Writing objects: 100% (65/65), done.
Total 65 (delta 5), reused 65 (delta 5)

Learning/.git
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), done.
Total 6 (delta 0), reused 6 (delta 0)
...

Note that other git commands show the resulting messages unlike the 'gc'.

Feature: Add targeting for groups in regular commands

So f.ex. today, we can do: mu st repo:repo1,repo2.. But we cannot add repo1, repo2 to a group x, and then do mu st repo:x.

I suggest that the repo: filter should first check for repositories by name, and if they don't exist, check for groups of the same name. If not already the case, groups should not be allowed to be named the same as repositories.

This will also allow me to do: mu st repo:x,other-repo to target repo1, repo2 and other-repo.

Note: Github is having issues today, so I may have double-posted this as #44. If that's the case, close this one.

Feature: Preserve Colors

Is it possible to preserve the colors that git outputs on it's own? It definitely makes a big difference when reading through the output when managing numerous repos.

Git aliases don't work?

I have this git alias:
git u == git pull --rebase --autostash

but running mu u gives:
Not enough arguments passed

Am I doing something wrong or does support for aliases need to be added?

Feature: Add targeting for groups in regular commands

So f.ex. today, we can do: mu st repo:repo1,repo2.. But we cannot add repo1, repo2 to a group x, and then do mu st repo:x.

I suggest that the repo: filter should first check for repositories by name, and if they don't exist, check for groups of the same name. If not already the case, groups should not be allowed to be named the same as repositories.

This will also allow me to do: mu st repo:x,other-repo to target repo1, repo2 and other-repo.

Multiple repos and authentication

When I pull from multiple repos git complains that cannot authenticate on one of them; but restricting the operation only on that repository using repo: is not reporting any error (see screenshot below). I don't understand what's the difference.

I'm using mu 1.8.1

Screenshot

Feature: Show remotes in status

I'd like a way to know, if any of my repos are ahead or behind their corresponding remotes. If possible, I'd also like to know this for any other branches I may have.

I do not know the relevant git commands, apart from the fact that git status will tell me if I'm behind or ahead...

I usually run mu status and then read through the messages, but it's quite cumbersome..

mu sh npm i - not working - attempts to run git instead

I run mu on two systems - my linux machine works fine, but my macbook does not.

ben@Benjamins-MacBook-Pro [16:28:01] [~/dev/sabstt/enterprise]
-> % mu --version
mu-repo version 1.8.1

When I run a custom sh command it looks like mu is trying to run it via git instead:

 ben@Benjamins-MacBook-Pro [16:32:00] [~/dev/sabstt/enterprise]
-> % mu sh npm i

  admin-api : git i

So obviously this fails... the strange thing is this works fine on my aforementioned linux box:

enterprise|โ‡’ mu sh npm i

 admin-api : npm i

That too is running 1.8.1.

THANK YOU

Not an issue of a bug report, but a big thank you for a great project!
The only one of this kind that I found that works properly on windows! ๐Ÿฅ‡

The only tiny feature suggestion: custom aliases maybe?

Thanks again!

Register all failed silently on OSX

Neither mu register --all or --recursive seemed to work on OSX. Both gave me empty results for mu list.

I didnt see any errors and so instead just used ls -d */ | xargs -I {} mu register {} instead.

mu itself seems to be working great though! Thanks so much for making it

Recursive mu register --all

Hi,
I just noticed that mu register --all only registers propjects within the current directory. Is it also possible to register all projects recursively? Manually registering them works as expected: mu register mygroup/myproject1 mygroup/myproject2 yields:

repo=mygroup/myproject1
repo=mygroup/myproject2
serial=False%

Thx for this fine project!

Feature: Add detection for redirects

Cloning using mu, against Gitlab, will work for https://xyz.com/Group/Repo, but will break future mu features like grouping, because Gitlab redirects to https://xyz.com/Group/Repo.git/.

I mentioned this in #42, but didn't create an issue on it. The issue is that for Gitlab.com, you can use both a non .git address, and a .git address to clone/work with, with Gitlab redirecting you to the .git version always.

This shows up in git cli with a warning: redirecting to https://xyz.com/Group/Repo.git/. The solution is to not have a redirect, as in cloning with the .git/ end. It will directly affect mu, in that all mu actions (st, up etc.), in that mu can't group the results.

I don't know how to fix this. I can think of the following:

  • Have git not follow redirects (somehow), detect the error and report back, let the user fix the link
  • Configure git (somehow) to store the redirected address
  • Perform an HTTP call (when the git address is HTTP/S) to REPO/info/refs, and follow any redirect till the end. Then use the final address as a cloning url.
  • Ignore that specific warning, so that mu can group correctly again

branch names "guessing" is not working

mu checkout used to work even with partial branch names.

In the current version, if the user doesn't give the branch full name, the following exception occurs:

  File "W:\Miniconda\lib\site-packages\mu_repo\action_checkout.py", line 27, in Run
    branch, _repo = iteritems(branch_to_repos).next()
AttributeError: 'dict_items' object has no attribute 'next'

mu register error

mu installed via pip command..never worked

Traceback (most recent call last):
  File "/usr/local/bin/mu", line 9, in <module>
    load_entry_point('mu-repo==1.3.0', 'console_scripts', 'mu')()
  File "/usr/local/lib/python2.7/dist-packages/mu_repo/__init__.py", line 312, in main_entry_point
    main()
  File "/usr/local/lib/python2.7/dist-packages/mu_repo/__init__.py", line 301, in main
    return Run(Params(config, args, config_file))
  File "/usr/local/lib/python2.7/dist-packages/mu_repo/action_register.py", line 66, in Run
    with open(config_file, 'w') as f:
TypeError: coercing to Unicode: need string or buffer, NoneType found

Thanks!

To support short name for a repo

Hi Dude,

Many thanks for the great tool!

Some time, the repo is in deep directory and I wanted to maintian the .mu_repo globally.

repo=/mnt/d/projects/working/someapp/RCN-918/app-config

This absolute path is too long to be put in group config

Is it possible to support a short name for the repo as follows:

repo=/mnt/d/projects/working/someapp/RCN-918/app-config, someapp-app-conf

So I can use someapp-app-conf in group config

Have a nice day!

Add Python 3 support

You can see the issue below.

% mu register test           
Repository: test registered
Traceback (most recent call last):
  File "/home/emp/src/mu-repo/mu", line 4, in <module>
    mu_repo.main()
  File "/home/emp/src/mu-repo/mu_repo/__init__.py", line 243, in main
    return Run(Params(config, args, config_file))
  File "/home/emp/src/mu-repo/mu_repo/action_register.py", line 50, in Run
    f.write(str(config))
  File "/home/emp/src/mu-repo/mu_repo/config.py", line 129, in __str__
    for group_name, repos in sorted(val.iteritems()):
AttributeError: 'dict' object has no attribute 'iteritems'

mu clone workflow requires multiple .mu_repo files

I like the mu clone workflow, so I checked this .mu_repo file into my "main" repo:

repo=.
repo=..\depA
serial=True

After I cloned the the "main" repo and its dependencies into a root folder, I still want to be able to use mu (e.g. mu rb). When I'm outside the main repo (e.g. in root or depA) mu can't see any .mu_repo file and will no longer work.

Should I maintain a separate .mu_repo file in my root folder?

`mu checkout <branch>` crashes with a stacktrace when the branch is a substring of one that exists

Here's how to reproduce:

C:\Temp> mkdir mutest

C:\Temp> cd mutest\

C:\Temp\mutest> echo a > a

C:\Temp\mutest> git init
Initialized empty Git repository in C:/Temp/mutest/.git/

C:\Temp\mutest (master)> git add a

C:\Temp\mutest (master)> git commit -m "a"
[master (root-commit) 6b01352] a
 1 file changed, 1 insertion(+)
 create mode 100644 a

C:\Temp\mutest (master)> git checkout -b ab
Switched to a new branch 'ab'

C:\Temp\mutest (ab)> git checkout -b abcd
Switched to a new branch 'abcd'

C:\Temp\mutest (abcd)> git branch
  ab
* abcd
  master

C:\Temp\mutest (abcd)> mu checkout abc
Traceback (most recent call last):
  File "C:\Miniconda\Scripts\mu-script.py", line 5, in <module>
    sys.exit(mu_repo.main_entry_point())
  File "C:\Miniconda\lib\site-packages\mu_repo\__init__.py", line 348, in main_entry_point
    main()
  File "C:\Miniconda\lib\site-packages\mu_repo\__init__.py", line 337, in main
    return Run(Params(config, args, config_file))
  File "C:\Miniconda\lib\site-packages\mu_repo\action_checkout.py", line 27, in Run
    branch, _repo = iteritems(branch_to_repos).next()
AttributeError: 'dict_items' object has no attribute 'next'

I think the problem is with this code (iteritems(branch_to_repos).next()), that fails in Python 3. In Python 3, changing it to next(iter(iteritems(branch_to_repos))) makes it work, but then next would probably have to be added to backwards.

Checkout a branch where name is composed by another one

When locally someone has a branch like rb-rfdap_workbench-v0.10.1 and a checkout is wanted on rb-rfdap_workbench-v0.10, then the following error occurs. There is a workaround which is to delete locally the branch which has the other name in composition.

rfdap โ†’ mu branch

. : git branch
master
rb-rfdap_workbench-v0.10.1

rfdap โ†’ mu co rb-rfdap_workbench-v0.10

File "/home/rosenbach/Work/miniconda/lib/python3.6/site-packages/mu_repo/action_checkout.py", line 27, in Run
branch, _repo = iteritems(branch_to_repos).next()
AttributeError: 'dict_items' object has no attribute 'next'

Symlinks with mu register --recursive

When calling mu register --recursive symlinks are followed. That is ok afaic. The problem is, that now the linked repository is listed two times. Once under its original path and once under the symlink.

For example:

projects/
	proj1/
		node_modules/
			proj3 โ†’ ../../proj3
	proj2/
	proj3/

The above structure will we detected as .mu_repo:

repo=proj1
repo=proj1/node_modules/proj3
repo=proj2
repo=proj3

Feature: new command to switch to common branches

A new command named switch that lists branches common to all registered repositories and lets him to switch all at the same time.

The branches would be indexed, allowing the user to just type the index instead of having to type a full branch name. For example:

]mu switch 
Common branches:
[1] fb-SSRL-2.9
[2] master
[3] stable-12.0-master

Switch to which branch? 1

In the example above, the user selected 1 which in turn checked out branch fb-SSRL-2.9 for all registered repositories.

Also, an option --all should be added to also list common remote branches besides local ones.

repositories with .git FILE are ignored

I have a lot repositories with .git file that has content like:

gitdir: /home/user/foo/bar/repo1

When trying to run mu register --all mu-repo does not treat such directories as a git repository

Enable a "silent mode" to suppress mu-specific command output.

When running a command like mu status --porcelain or a more low-level equivalent for checking for changes such as mu diff-index HEAD --, the output for each command being run makes it inconvenient to use the output of these commands conveniently. Can a parameter or toggle be added to use mu "quietly" so that commands can more easily be run where the mu-specific output is not needed or where the only thing we care about is that there is output, not which repo it comes from?

mu not working after recent commit - all repos give me a usage message as if my arguments were wrong

Symptom is all repos give me a usage message as if my arguments were wrong:

 mu-repo : git status
    usage: git [--version] [--help] [-C <path>] [-c name=value]
    [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
    [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
    <command> [<args>]

I reverted to commit d9f8bf3 and everything works.

mu clone

It'd be really nice if I could do

mu clone <repo> <folder>

and it cloned and registered each repo. And then after checking out a repo with a .mu-repo

mu clone

which would pull all repos down.

De-register?

How do I un/de register a git repo that I don't want to pull from anymore?

Cloning repos with slashes in their names

Hey,

I'm trying to clone a repo using this guide. I've set up my remotes without any user or group names in them (ie. https://user@host/), expecting to be able to clone a/b to effectively get https://user@host/a/b.git -- but this doesn't work.

$ mu clone A/B

 . : git config --get-regexp mu-repo.remote-base-url
Unable to clone because the repository name for cloning with mu was not detected.

If I clone something without slashes, it shows the paths it tries (which would be correct, if I had a project with that name :P).

Could slashes in repo names be allowed? :)

Feature: Dynamic repositories detection while processing certain directory

In my use case the number of repos in a directory can change over time.

Therefore I need to register them before any mu operation.

A nice solution for that would by a dynamic detection of all repos in certain directory.

For example in the .mu_repo file by adding property like this:

repo=directory\*

Would cause mu-repo first to detect all repositories in the indicated directory, and than execute git operation on it.

Allow remotes other than 'origin'

When working with more than one remote, it's useful to name the remote according to e.g. the service it came from:

git clone --origin github https://[email protected]/fabioz/mu-repo

or

git clone --origin home-nas git://home-nas/mu-repo

etc

mu-repo currently assumes that a remote is named 'origin'. When it isn't, many commands fail.

Executable Broken; "No Such File" After Fresh Install

$ pip install mu-repo
Collecting mu-repo
  Using cached mu_repo-1.6.0.tar.gz
Installing collected packages: mu-repo
  Running setup.py install for mu-repo ... done
Successfully installed mu-repo-1.6.0

$ mu
-bash: /Users/swivelgames/Library/Python/2.7/bin/mu: No such file or directory

Support quotes in Arguments

The following breaks due to mu not honoring quotes in arguments

$ mu log --after="2016-09-07 19:30 CDT" --before="2016-09-07 19:00 CDT"

  repo1 : git log --after=2016-09-07 19:30 CDT --before=2016-09-07 19:00 CDT

...

mu group cloning all repo's in a group

I am not able to find a way to clone all repo's in a group, created multiple groups and register repo's but can't seem to clone them. Can you kindly suggest how I can clone all repo's in a group.

Shortcut conflicts with shortcut in my .gitconfig

the mu p shortcut conflicts with a shortcut that exists in my git config. Thus, running mu p takes a different action than git p. That is unexpected behavior and quite jarring.

I think overriding user-set configuration from git is not appropriate when you explicitly support the behavior.

Is it possible to set a config to first honor git config shortcuts before using the mu shortcuts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.