I'm in trouble figuring out how to organize a mercurial repository for a Django project I'm starting. This is the current configuration:
.
├── .hg
├── docs
├── manage.py
├── project
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── requirements.txt
For how my workflow is, I'd prefer to keep the activities related to project and docs separated. Having two dedicated repositories could be a way to solve the issue, but then I should clone two repos if I want both the docs and the project, while I'd be optimal to clone only one all-inclusive repo, as the one of the picture above.
Is it possible to obtain what I want, and how to reorganize project, docs and repositories?
It's possible to nest repositories under a parent one. See Mercurial Subrepository.
BUT - this is not a good practice. See FeaturesOfLastResort explanation here.
In our R&D, we have many repositories, and when needed, the developers are already used to cloning the needed ones (2 or more) for the relevant activity.
I hope this helps.
You can have repositories nested inside parent repo. It is considered to be a bad practice. I think you should split your docs and code into separate repositories.
You can add hooks on desired operations so actions taken in one repository could automatically be executed in the other. In addition to that you can also use aliases for operations on both repos, so you'll have special commands for operations in both repos.
To solve cloning issues you can create script which will clone both repos in desired folder.
Related
Problem
Problem: I can't get a local build of my GitHub hosted website. My gh-pages branch on my local clone of my GitHub repo does not build right.
Specifically, markdown files don't build to the _site folder as html unless they start with the YAML frontmatter demarcation (--- newline ---), and when I serve them on localhost they don't pickup any CSS, I can't really preview what it will look like on GitHub. If the frontmatter demarcation is not in the markdown file it is copied to the _site folder as markdown.
You can see below I have two markdown files ideas.md and local-jekyll-build-theme-trouble.md.
ideas.md has the frontmatter things and builds as an html file that won't preview with any theme.
local-jekyll-build-theme-trouble.md doesn't have the frontmatter and 'builds' as markdown and 404s when I try to hit it in the browser (unless I add the .md extension in the URL, boo)
It doesn't make any difference if I have committed changes or not. It doesn't matter if I run jekyll via 'bundle exec' or not. I don't get any errors from jekyll (even when using the --trace option)
In Contrast...
When I push to GitHub, both pages seem to work properly. I can go to https://breedlovedesign.github.io/ideas/local-jekyll-build-theme-trouble without putting .md in the URL and https://breedlovedesign.github.io/ideas/ serves index.html fine. Both get all the lovely theme CSS as specified in my config.
I had assumed that both files were being converted to html but I double-checked and the _site folder on GitHub also has index.html and local-jekyll-build-theme-trouble.md.
_config.yml
theme: jekyll-theme-minimal
System Info
MacOS 10.15.6
Ruby Version
~/.../devo/ideas on gh-pages*
$ rbenv version
2.6.5 (set by /Users/johnbreedlove/Sync/devo/ideas/.ruby-version)
Gemfile
gem "github-pages", "~> 209"
Jekyll Build Output
~/.../devo/ideas on gh-pages*
$ bundle exec jekyll serve
Configuration file: /Users/johnbreedlove/Sync/devo/ideas/_config.yml
Source: /Users/johnbreedlove/Sync/devo/ideas
Destination: /Users/johnbreedlove/Sync/devo/ideas/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.616 seconds.
Auto-regeneration: enabled for '/Users/johnbreedlove/Sync/devo/ideas'
Server address: http://127.0.0.1:4000
Server running... press ctrl-c to stop.
Directory Structure
~/.../devo/ideas on gh-pages*
$ tree
.
├── Gemfile
├── Gemfile.lock
├── _config.yml
├── _site
│ ├── assets
│ │ ├── css
│ │ │ └── style.css
│ │ ├── fonts
│ │ │ ├──...
│ │ ├── img
│ │ │ └── logo.png
│ │ └── js
│ │ └── scale.fix.js
│ ├── index.html
│ └── local-jekyll-build-theme-trouble.md
├── index.md
└── local-jekyll-build-theme-trouble.md
10 directories, 30 files
Contents of /index.md
---
---
# icanhaz themes pls?
must I use YAML frontmatter?
Yes, you must use the YAML front matter. It is made explicit in the jekyll documentation.
Any file that contains a YAML front matter block will be processed by Jekyll as a special file. The front matter must be the first thing in the file and must take the form of valid YAML set between triple-dashed lines.
If you want to use Liquid tags and variables but don’t need anything in your front matter, just leave it empty! The set of triple-dashed lines with nothing in between will still get Jekyll to process your file.
If it works in GitHub Pages, I assume that it does a little preprocessing of its own. But for Jekyll alone, files without front matter are left as they are.
I have the following file structure in my Jekyll project:
├── _articles
│ ├── bar
│ │ └── widget.md
│ ├── bar.md
│ └── phone.md
└── foo.md
See here: https://github.com/janpio/jekyll-test
_articles is a collection that is defined in _config.yml:
collections:
articles:
title: Articles
output: true
permalink: :path
On Github Pages this is built into these URIs:
https://janpio.github.io/jekyll-test/bar/widget
https://janpio.github.io/jekyll-test/bar
https://janpio.github.io/jekyll-test/phone
https://janpio.github.io/jekyll-test/foo/
See here: https://janpio.github.io/jekyll-test/
That is all fine and as expected.
But when I bundle exec jekyll s this project locally1 it doesn't work the same way. I get the expected URIs:
http://127.0.0.1:4000/bar/widget
http://127.0.0.1:4000/bar
http://127.0.0.1:4000/phone
http://127.0.0.1:4000/foo/
But the problem is that #2 gets redirected to 127.0.0.1:4000/bar/ and shows a directory listing instead of the actual page!
Looking at _site this is the file structure that is generated:
├── bar
│ └── widget.html
├── bar.html
├── foo.html
├── index.html
└── phone.html
So I can access bar.md at http://127.0.0.1:4000/bar.html.
How can I fix this?
1 My Gemfile is so the environment should be identical to Github Pages: https://github.com/janpio/jekyll-test/blob/master/Gemfile
Update for Jekyll 3.6.x
The 3.6.0 Jekyll release changed this behaviour:
Fix serving files that clash with directories (#6222) (#6231)
Unfortunately, these changes didn't really fix the problem but replace it with a less serious one: The link now doesn't show the directory listing any more but the correct page, but the path is still different in that it adds the / at the end. Unfortunately as a regression bar/widget doesn't render the correct content any more but shows bar.md.
These are the first solutions that come to my mind:
Stop using 'pretty URLs'
Use only index.md files (each of them in a seperate folder)
Prevent naming collisions between folders and files
Create an index.html file in the bar folder that redirects to bar.html (although that might create a redirect loop)
Update for Jekyll 3.7.x
The 3.7.0 Jekyll release included a PR that should fix this problem:
return correct file in dir if dir has same name as file
I currently have a Jekyll project with this structure:
├── _config.yml
├── assets
| ├── js
| ├── css
| └── images
And my _config.yml looks like:
.
.
lang: en
destination: _site/en
.
.
So, when building the project all the site is inside the _site/en/ folder, this includes de assets folder with all my static assets (Images, css, js, etc).
Is there a way to build the page configuring a custom destination for the assets folder?
├── _config.yml
├── _site
| ├── en
| └── assets
I tried by adding this to my _config.yml (having installed jekyll-assets) without lucky:
assets:
dirname: assets
baseurl: /assets/
sources:
- assets
Since the root folder is now: /_site/en/ you need to step down a level.
Try using this:
../assets/
This will step down a directory out of /en/.
At the end, I'm building my site in several jekyll build executions. So, for me the simplest way of doing this is by excluding the assets folder for each language build and simply run a 'cp -a' of the assets folder to the _site/ folder. In this case, I avoid using another plugin and simply copy the files you need.
I'm trying to configure a DevOps pipeline build stage for building a container using the IBM Container Service builder.
I'm trying to build a docker image that sits inside a sub-folder /server inside the repository:
$ tree keycloak
keycloak
├── adapter-wildfly
│ ├─ ...
├── server
│ ├── Dockerfile
│ ├── ...
├── ...
At the top of my Build Script, I thought I could set the folder by setting the WORKSPACE environment variable:
export WORKSPACE=${WORKSPACE}/server
However, the build fails. At the end of the log file, I see:
2017-07-06 15:39:32 UTC : Dockerfile not found in project
The git project containing the Dockerfile that I'm trying to build is: https://github.com/jboss-dockerfiles/keycloak
Update:
I've put a (nasty) workaround in that works for now, but I'd rather have a less hacky solution. In my deployment script, I'm moving the folder that contains the Dockerfile into the parent folder:
...
# hacky workaround to build a Dockerfile not in the top level folder
mv ${WORKSPACE}/server/* .
if [ -f Dockerfile ]; then
...
The build script by default looks for the Dockerfile in the current directory, but then builds it from the fully qualified WORKSPACE. So you need to update the WORKSPACE and change into the new workspace directory:
export WORKSPACE=${WORKSPACE}/server
cd ${WORKSPACE}
Now, I have a source tree as following:
+ Dev
+-- Source
| +-- ...
+-- Samples
| +-- ...
+-- ...
Beginning, I had create a Mercurial repository in folder "Dev/Source". It's work fine. But now, I want extend the repository to include "Dev/Samples" folder too. I found only one way to do that. I must drop old repository and create a new in "Dev" folder. But the version history of original repository is so important for me. There has any solution to import original history to new repository? or Mercurial has another support to change the root folder of repository?
Thanks.
You can
use the convert extension to create a new repo with the aligned files (see the --filemap option)
create a Source folder in your repo and move all files within there
The first one provides a cleaner history, while the second one does not invalidate existing clones.