You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clones a Mercurial repository. When cloning from more than one Hg Repo, it will merge the two repositories
into one Hg Repo. This repo will contain all the branches from both repositories but will have its default
branches merged into one branch.
Argument
Description
Type
Required
Default
from
Object OR String OR Array<String>
Yes
to
Object
Yes
to.url*
String
Yes
null
to.name*
String
Yes
null
to.username
String
No
null
to.password
String
No
null
to.path
String
No
Current Directory/<Cloned repo name>
done
Callback function
Function
No
Only one of these must be passed.
Returns
Description
Promise<HgRepo>
Console output
constHg=require('hg-plus')();letto={url: 'http://hostname.com/my/repository/url',username: 'me@host.com',password: 'secret',path: 'path/to/my/new/repo'};// Basic from a repo urlletfromURL='http://hostname.com/the/repo/i/want/to/clone';letrepo1=awaitHg.clone(fromURL,to);// From a repo objectletfromObj={url: 'http://hostname.com/the/repo/i/want/to/clone',username: 'me@host.com',password: 'secret',};letrepo2=awaitHg.clone(fromObj,to);// From a list of repo urls/objectsletfromArray=[{url: 'http://hostname.com/the/repo/i/want/to/clone1',username: 'me@host.com',password: 'secret',},{url: 'http://hostname.com/the/repo/i/want/to/clone2',username: 'me@host.com',password: 'secret',}];letrepo3=awaitHg.clone(fromArray,to);// Similar functionality with the callback structureHg.clone(from,to,(error,results)=>{console.log(results);});
Hg create
Creates and initialized a Mercurial repository.
Argument
Description
Type
Required
Default
options.to
Object
No
options.to.url
String
No
null
options.to.username
String
No
null
options.to.password
String
No
null
options.to.path
String
No
Current Directory
done
Callback function
Function
No
Returns
Description
Promise<HgRepo>
constHg=require('hg-plus')();// Basicconstrepo=awaitHg.create();awaitrepo.init();// With an objectletto={url: 'http://hostname.com/my/repository/url',username: 'me@host.com',password: 'secret',path: 'path/to/my/new/repo'};letrepo=awaitHg.create(to);awaitrepo.init();
Hg getRepo
Get a HgRepo instance from an already existing Mercurial repository.
Argument
Description
Type
Required
Default
options.from
Object
No
options.from.url
String
No
null
options.from.username
String
No
null
options.from.password
String
No
null
options.from.path
String
No
Current Directory
Returns
Description
Promise<HgRepo>
constrepo=Hg.getRepo({username: 'me@host.com',password: 'secret',path: 'my/local/cloned/repo'})awaitrepo.pull()// OR from current directoryconstrepo=Hg.getRepo({username: 'me@host.com',password: 'secret',});
Hg version
Gets the version of the installed mercurial package