Page MenuHomePhabricator

Maybe rename "Import an Existing External Repository" in New Repo Wizard
Closed, DuplicatePublic

Description

The term "Import" is a little confusing for some users; See discussion below. It seems to imply "get content from somewhere and then host it".

Original report:

i've got a repo which was imported from our internal git repo, but after many heck i delete it:

./bin/remove destroy rV
rm -rf /var/repo/V

then i try to reimport it with the same callsign and and the same name:

  • Create or Import Repository
  • Import an Existing External Repository
  • Git
  • same repo name (Vidux) andd callsign (V)
  • same local http git repo url (without password auth required)
  • default policy
  • Configure More Options First
  • Edit Hosting
  • Host Repository on Phabricator
  • SSH/HTTP read/write
  • Activate Repository

And the import process finish in a few seconds with "Fully Imported" even though it' s a rather big git repo. but when i select the repo i've got:

Empty Repository
This repository does not have any commits yet.
`

and the command line git clone works for the url. I can't find anything in the log file so i can't figure out what can happened.

Event Timeline

lfarkas updated the task description. (Show Details)
lfarkas added a project: Diffusion.
lfarkas added a subscriber: lfarkas.
revi renamed this task from Can't reimport git repository i nto diffusion to Can't reimport git repository into diffusion.Oct 31 2015, 5:15 PM
revi added a subscriber: revi.
  • Host Repository on Phabricator

That's the opposite of "Import an Existing External Repository".

If you want to host the repository on Phabricator, you can git push stuff to it, but it will not pull anything from an existing external repository.

actually it's not true:-) it IS possible to import it Phabricator's diffusion a git repo and host it inside. since i already did it many time. sometimes it's working sometimes it's not (with the same source and the same repo).
actually i do some more debugging.

  • if i import it with " Start Import Now" in stead of "Configure More Options First" which means no hosting ie.: Host Repository Elsewhere. then it's works and can import the repo perfectly. so the only problem is in case of hosting repo. it'd be useful to some kind of log what kind of git command was used, what kind of return value was used etc.
  • from now on i'm no longer be able to import the repo with hosting again properly. but if i start with a fresh install of Phabricator (ie totally new database and everything else) then it's works again until i delete the first imported repo.

Phabricator repositories work in one of two modes:

  • Import an Existing External Repository

Phabricator will look at the external repository, and will run git fetch every once in a while. Users will use git push and git pull to/from wherever the External repository is.

  • Host Repository on Phabricator

Phabricator will not look anywhere for the repository, and never run git fetch.
Users run git push and git pull to/from Phabricator.

It's probably OK to switch a git repository from "Import" to "Host" mode, which will make it stop importing it and start hosting it; After that, Phabricator will not get any more updates from the remote. That's probably what you're seeing when you do "start import now" and then switch over to "Host on Phabricator".

Are you a user or developer of Phabricator?
Actually there three ways to create a repo in Phabricator (let's talk about only git repo).

  • Create a New Hosted Repository Create a new, empty repository which Phabricator will host.
  • Import an Existing External Repository Import a repository hosted somewhere else, like GitHub, Bitbucket, or your organization's existing servers. Phabricator will read changes from the repository but will not host or manage it. The authoritative master version of the repository will stay where it is now.
  • Import an Existing External Repository and at the same time Create a New Hosted Repository for it. This means import a repository hosted somewhere else, like GitHub, Bitbucket, or your organization's existing servers. Then create a new, repository (based on the import source) which Phabricator will host.

This third option is possible if you choose Import an Existing External Repository but do NOT "Start Import Now" in stead of "Configure More Options First" and then choose "Host Repository on Phabricator". And only after this "Activate Repository".

My problem what this but report about is that the third option worked for me many times, BUT sometimes it's "start to" not working ie not import anything and finish almost immediately. When it's happened the only way to make it's work again the delete diffusion's database. So it's very clear to me it's a bug in Diffusion's import code.

I'm a contributor, and I know much of the code.

What you're trying to do - have Phabricator host a repository and have all your code there - is expected to be accomplished by creating an empty, Hosted repository, and then git pushing into it all the existing content.

In the terms of Phabricator, "Importing" a repo means "git clone --bare" (See https://secure.phabricator.com/diffusion/P/browse/master/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php;c45ba304168239f0600d780476dc705b54b6f492$211-226), and then running "git fetch --prune" (https://secure.phabricator.com/diffusion/P/browse/master/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php;c45ba304168239f0600d780476dc705b54b6f492$315) to get new content.

"Hosting" a repository means running "git init --bare", not executing git fetch (See https://secure.phabricator.com/diffusion/P/browse/master/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php;c45ba304168239f0600d780476dc705b54b6f492$86-97), and allowing to serve it. When users git push to it, the changes are picked up as part of the push process.

This is all done by the daemons, including both init or clone.

Once a repository is imported, you can switch it to "hosted" mode; That will make Pharbicator stop fetching updates, and configure it for serving.
This allows you to import an existing repository, wait for it to complete the first round of importing (Until the repository Edit page shows "Working Copy OK" and "Updates OK"), and then switch it to Hosted. In order for this to happen, you need to let the daemons run ("Start Import Now").

you said the only one way to import & host is to first import and i can only switch to host after the import finished? since i almost certainly do it in a way as i described above the third way (ie set it to hosting before start activate import. and anyway why is it possible to set the hosting repository before start to import? if it's not possible or not supported in this way then remove (or at least should have to be grayed out) this possibility in the "Configure More Options First" ie. repository settings page.

Would it be less confusing if instead of "import", we used the word "observe" everywhere?

The settings page you get is just the repository edit page. It allows you to switch between "hosted" and "import/observe" modes, and all other settings.

Wouldn't it be cleaner to add "Import and Host" option during repo creation? imho a migration from anything to Pharbicator the most obvious way is to migrate the source repo too.

It might make sense to add a "Create a Hosted repository and copy content from somewhere", but it's not the most useful feature to build; Most installs either push the content using git push, or do import-and-then-host.

Many installs want to use the Imported ("Observe") mode, because they have existing hosting already set up and they don't want/can't replace it.

avivey renamed this task from Can't reimport git repository into diffusion to Maybe rename "Import an Existing External Repository" in New Repo Wizard.Nov 3 2015, 6:13 PM
avivey updated the task description. (Show Details)

I'm going to merge this into T10748, which is now more clearly the way forward.

In particular, I'm using the word "observe" in new documentation to try to make this behavior of this operation more clear:

https://secure.phabricator.com/book/phabricator/article/diffusion_uris/