Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronizing all branches? #3

Closed
berniwa opened this issue Feb 1, 2021 · 8 comments
Closed

Synchronizing all branches? #3

berniwa opened this issue Feb 1, 2021 · 8 comments

Comments

@berniwa
Copy link

berniwa commented Feb 1, 2021

I'm trying to synchronize all branches of two servers, everything including master and other branches.

Is that possible? How can this be achieved?
Currently I can only set prefixes for certain strategies, but I can't seem to be able to set and empty prefix.

@it3xl
Copy link
Owner

it3xl commented Feb 1, 2021

Sorry, there were some options but I dropped them.
This all-branches-synchronization requires some community feedback to do everything right.

Please, could anybody answer some questions?
1.
Do you really need this 24/7?
Or will it be a one-time initial sync?
2.
Is it possible to limit the number of branches without prefixes to be synchronized?
Let's say if you are syncing only some master, development and stage branches?
3.
What my sync strategy do you prefer?
Or should it be implemented for both strategies - victim and conventional?
4.
There's a third strategy. I call it master-slave.
Is it OK if one repository will be updated in a slave mode?
I.e. sync conflicts will be always solved in a favor of the master repository.
With this, you will be deleting branches only through your main repository. You'll lose a capability to step back in Git history on you slave repository.

@berniwa
Copy link
Author

berniwa commented Feb 2, 2021

Hi, thank you for your quick response.

The use-case is simple:
We have a lot of different customers and therefore a lot of different GIT tools (currently we deal with Github/Gitlab/Gitolite/Bitbucket and CodeCommit). I'm really tired of handling all the login credential and cross pushes for all customers - as this can be really time consuming. So I want to be able to sync our server with our customer's servers. This would allow us to use our company internal infrastructure and user management (every user that is allowed can push directly to the customers servers) - while just the server synchronizes with the customers.
The problem is, that I can't control the customers server and I also can't control how the branches are named by the customers developers.

To your questions:

  1. Yes I will need this 24/7
  2. No, as I don't know what branches will be created by the customer
  3. I think that it really doesn't matter, as the synchronization will
    either be triggered by a webhook or by fast polling (<5min).
    So the cases were two developers push breaking changes to the same branch at the same time are pretty slim.
    I guess the victim strategy will do fine.
  4. None of the servers should be slave, as data will be pushed from both sides

@it3xl
Copy link
Owner

it3xl commented Feb 2, 2021

Let's invent a configuration flag for this mode
victim_strategy__ignore_prefixes=1
sync_everything_by_victim_strategy__ignore_prefixes=1
Tough choice.

Mentioned Git tools may create you a burden for such a sync-all-branches mode.

  • Autogenerated garbage branches.
  • Locked for updating branches.

Development started.

@berniwa
Copy link
Author

berniwa commented Feb 6, 2021

Ok that sound great to me!

You could just allow and empty prefix for the victim branches or the side_x_conventional_branches.
This would allow for several different combinations.

victim_branches_prefix=""
side_a_conventional_branches_prefix="mine"
side_b_conventional_branches_prefix="theirs"
ignored_branches_prefix="secret"

This could for example sync all branches with the victim strategy, that don't start with "mine" or "theirs". Branches starting with mine/theirs will simply be synchronized in conventional mode. Addtionally some branches could be held secret.

This is just a thought - I would be grateful for any help ;-)

@it3xl
Copy link
Owner

it3xl commented Feb 6, 2021

Oh, you confirmed my thoughts. That's great, thank you. I'm doing exactly in this way.
I think I'll finish soon and let you know here.

It will be possible to comment out or set it empty.
victim_branches_prefix=;
#victim_branches_prefix=@
victim_branches_prefix=''
and use conventional prefixes in parallel, too.

After that, I'm hoping to remove and replace ignored_branches_prefix by an automation.
It'll take more time but shouldn't affect you.

@it3xl
Copy link
Owner

it3xl commented Feb 6, 2021

Actually, you can use the develop branch of git-repo-sync if you want to try. It was ready couple days ago.
I hardly change something more for the current issue except minor refactoring.

I'll be glad for any response.

I didn't covered yet all known test cases by auto-tests for unprefixed branches (All-Branches-Sync). But 70% is covered.
Please create a local copy (git clone) of your both Git remote repositories of your first sync pair attempt, except if they are empty.

@it3xl
Copy link
Owner

it3xl commented Feb 17, 2021

Hi @berniwa, It is done. I've merged everything to the master branch. e32a625
Also, I've deployed it to some clients. But they do not use All-Branches-Syncing.

I'll stay this issue open for a couple of days or weeks, if anything...

I'll continue to commit to the master branch but this will mostly be README.md changes.

@berniwa
Copy link
Author

berniwa commented Feb 18, 2021

Hi @it3xl thanks a lot! Great work!
At first glance everything worked fine, I'll test it further in the next days and report back if I find something!

@berniwa berniwa closed this as completed Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants