Links קישורים

Soft תוכנות

Mercurial Mercurial

Terminal Terminal


Fab Academy Fab Academy

Guides מדריכים

FabLab Wiki FabLab Wiki

Central Guide Central Tutorials

Hg Init Hg Init

Vertion control - Mercurial

מערכת ניהול גירסאות

המשמעות היא שמערכת מאפשרת לעקוב גירסאות ושינויים מרובים של אותה יחידת מידע. ישנן מערכות רבות שכוללות מעקב אחרי שינויים והשוואה לגרסאות קודמות (ממש כמו: "מעקב אחרי שינויים" במסמי Word) . מערכות ניהול גרסאות כדוגאמת Mercurial מספקות מאפשרות יכולות עשירות יותר, כגון מספר גרסאות במקביל ומיזוג שינויים של משתמשים שונים. Mercurial Program manegment

Shapedo visualize version control on 3D models and make it easier to understand
To install Mercurial and to add this year archive flow the FabLab Wiki

מידע נוסף והסבר על מערכת ניהול הגירסאות Mercurial ניתן למצא באתר Hg Init

This year we are using the FabAcademy servers and not MIT's remeber that when you install Mercurial on your computer

  • Install Mercurial on Ubuntu FabLab Wiki Tutorial or AKF Tutorial
  • Install Mercurial on Win FabLab Wiki Tutorial or AKF Tutorial
  • Install Mercurial on Mac OSX FabLab Tutorial or AKF Tutorial

  • hg pull

    add your files to the folder

    hg add
    hg commit -m “meangingful message”
    hg push

    Mercurial Cheat Sheet [from AKF Tutorial]

    If you have added content to your archive

    hg add

    Check to see what files you have added to your copy of the archive before committing. After typing hg status, there will be a list of the files that you added. Make sure that you are not adding huge files. If a file is large, you can delete it.

    hg status

    If you delete a tracked file from the archive:

    hg rm -A

    You will get a long list of files – do not be alarmed. This will remove the deleted files in all directories.

    To commit the files after you are finished with your change:

    hg commit -m “meangingful message”
    To get content from the global archive:
    hg pull
    After pulling – carefully read the messages that Mecrual gives you and respond to them.

    If you do not understand the messages, look at this guide: Mercurial Troubleshooting

    After responding to and resolving all the messages from the pull – you can push your committed changes to the global copy of the archive

    hg push

    Never, ever, EVER use push -f to force. You will regret it.

    If you get messages from Mercurial – read and respond to them. If you do not understand the messages, look at this guide: Mercurial Troubleshooting

    Mercurial Troubleshooting [from AKF Tutorial]

    Push Messages

    TAKE NOTE: If you try to push and Mercurial mentions:
    - multiple branches
    - multiple heads
    - outstanding uncommitted changes
    -archive has diverged
    -or any other similar message

    and then asks if you want to push anyway..

    DON'T DO IT! This creates multiple heads.

    After you give Mercurial a command, look at the output, read all the messages and respond to them.
    These notes should help with some common problems we have all been having.

    General Command Meanings:
    pull pulls down current state of the archive (brings changes)
    merge remote hg directory has new changes, if your local copy is an older version, merge reconciles them.
    commit stores a "snapshot" of your copy of the archive
    push sends changes back to central server we are all using (MIT copy)
    update takes the changes and puts them in the working copy of the directory

    If You Have Updated Files:

    - If you added new work or updated files in the repository:
    hg add
    hg commit -m "your commit message here"
    hg pull 
    - if you get new stuff (files added) when / after pulling and Mercurial tells you that you need to merge.
    - you need to merge:
    hg merge 

    If You Delete a Local File / Directory:

    - You will need to tell Mercurial to "record a delete for missing files"
    - You will run into problems if you don't do this!
    - error depicted here:

    hg add 
    hg rm -A

    - You will get a very long listing both of removed files and files that Mercurial says "still exist and will not be removed".


    [many files listed above as "not removing"............]
    not removing Web/videos/video/module_02.html: file still exists (use -f to force removal)
    removing Web/labs/providence/anna_kaziunas_france/resources/html_workshop/ HTML_Basics_2.0.odp

    --> do not force remove anything
    - This is what should happen.

    - Mecural is updating.

    hg commit -m "your commit message here"
    hg pull

    Errors and Issues:

    If the Archive Has Diverged:

    You try to push and get:

    "archive has diverged" message
    "abort: push creates new remote heads on branch 'default'!"
    "abort: crosses branches"
    something similar to the above messages

    - You need to Pull and Merge. DO NOT FORCE PUSH.

    - First, pull to make sure you have an up to date copy of the archive.

    hg pull 
    - if you try to push and get: "abort: outstanding uncommitted changes (use 'hg status' to list changes)"
    hg commit -m "your commit message here"
    - You should check status:
    hg status

    - if you have a "!" in front front of a file or directory name in the status listing, it means you deleted a file that Mercurial is tracking.


    $hg status
    ! Web/labs/providence/AnnaKaziunasFrance/resources/html_workshop/ HTML_Basics_2.0.odp
    ! Web/labs/providence/AnnaKaziunasFrance/resources/html_workshop/ HTML_Basics_2.0.pdf

    - To fix this --> do the following:

    hg add 
    - tell Mercurial to record a delete for missing files
    hg rm -A
    hg commit -m "your commit message here"
    hg pull

    - if you get a message about "multiple heads" --> see next topic below.

    If Mercurial Mentions "Multiple Heads":


    $ hg pull
    pulling from ssh://[email protected]/academy
    searching for changes
    adding changesets
    adding manifests
    adding file changes
    added 50 changesets with 162 changes to 113 files (+1 heads)
    abort: crosses branches (merge branches or use --check to force update)
    warning: changegroup hook exited with status 255
    (run 'hg heads' to see heads, 'hg merge' to merge)

    - to remove heads, list heads:
    hg heads 

    - Mercurial will list heads .


    $ hg heads
    changeset: 480:00cdd8eef593
    tag: tip
    parent: 479:f09cf2bc12ba
    parent: 476:e519545ebdd5
    user: username <[email protected]>
    date: Thu Feb 03 13:40:38 2011 +0100
    summary: merge

    changeset: 430:da050aca6ab4
    user: Anna Kaziunas France <[email protected]>
    date: Thu Feb 03 08:23:21 2011 -0500
    summary: created external css for resources page

    - To merge with one of these heads (you can have many heads) --> type the number after "changeset:"
    - I have shown the number in bold so you can see them more easily.
    - For example, to merge with head -->changeset: 480:00cdd8eef593
    - type:

    hg merge 480
    - If there are multiple heads (more than one listed as the output of hg heads) you wil need to repeat the merge for each head until there is only one left
    -Then commit your changes:
    hg commit -m "commit message"
    hg push  
    - don''t push if it says you shouldn't - "archive has diverged" - then pull instead.
    hg pull
    hg update
    hg heads  
    if you can't get all the heads resolved or the error messages - re-clone the archive.

    To Re-Clone The Archive:

    - if you have new work in your firstname_lastname directory, make a copy and save in a directory outside of the "academy" directory
    - delete the "academy" directory
    - re-initialize the hg repository:
    hg init 
    - The rest of the instructions are here
    - follow steps 5 to the end of the tutorial.

    If You Get a "waiting for log on working directory" Message:

    - use CONTROL + C to interrupt

    .DS_Store Error - MAC only

    - If you try to merge and get the following:
    $ hg merge
    local changed Web/labs/.DS_Store which remote deleted
    (d)elete? ged version or

    --> hit the <ENTER> key.
    - Then commit the changes
    hg commit -m "removed .DSstore file"